Patchwork [U-Boot,2/7] ahci: fix unaligned access

login
register
mail settings
Submitter Rob Herring
Date May 21, 2013, 10:44 p.m.
Message ID <1369176276-1895-2-git-send-email-robherring2@gmail.com>
Download mbox | patch
Permalink /patch/245440/
State Superseded
Delegated to: Tom Rini
Headers show

Comments

Rob Herring - May 21, 2013, 10:44 p.m.
From: Rob Herring <rob.herring@calxeda.com>

gcc 4.7 will generate unaligned accesses to local char arrays, so make
them static to avoid that.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 drivers/block/ahci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Tom Rini - May 24, 2013, 1:45 p.m.
On Tue, May 21, 2013 at 05:44:31PM -0500, Rob Herring wrote:

> From: Rob Herring <rob.herring@calxeda.com>
> 
> gcc 4.7 will generate unaligned accesses to local char arrays, so make
> them static to avoid that.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>

Reviewed-by: Tom Rini <trini@ti.com>
Wolfgang Denk - May 24, 2013, 6:35 p.m.
Dear Rob Herring,

In message <1369176276-1895-2-git-send-email-robherring2@gmail.com> you wrote:
> 
> gcc 4.7 will generate unaligned accesses to local char arrays, so make
> them static to avoid that.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> ---
>  drivers/block/ahci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
> index b89be06..3cb37e7 100644
> --- a/drivers/block/ahci.c
> +++ b/drivers/block/ahci.c
> @@ -627,7 +627,7 @@ static void dump_ataid(hd_driveid_t *ataid)
>   */
>  static int ata_scsiop_inquiry(ccb *pccb)
>  {
> -	u8 hdr[] = {
> +	static u8 hdr[] = {
>  		0,
>  		0,
>  		0x5,		/* claim SPC-3 version compatibility */

Make it also "const" ?

Best regards,

Wolfgang Denk

Patch

diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
index b89be06..3cb37e7 100644
--- a/drivers/block/ahci.c
+++ b/drivers/block/ahci.c
@@ -627,7 +627,7 @@  static void dump_ataid(hd_driveid_t *ataid)
  */
 static int ata_scsiop_inquiry(ccb *pccb)
 {
-	u8 hdr[] = {
+	static u8 hdr[] = {
 		0,
 		0,
 		0x5,		/* claim SPC-3 version compatibility */