]> git.sur5r.net Git - u-boot/commitdiff
ahci: Fix gcc 4.4 compiler warning
authorKumar Gala <galak@kernel.crashing.org>
Mon, 13 Jul 2009 14:24:00 +0000 (09:24 -0500)
committerWolfgang Denk <wd@denx.de>
Thu, 23 Jul 2009 19:04:58 +0000 (21:04 +0200)
ahci.c: In function 'ata_scsiop_read_capacity10':
ahci.c:616: warning: dereferencing type-punned pointer will break strict-aliasing rules

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
drivers/block/ahci.c

index e1b66fd4b6d3a9fa7b475ac66f796206a1f10e25..b0d17922baa2635600a04f146b4684a031be888c 100644 (file)
@@ -602,7 +602,7 @@ static int ata_scsiop_read10(ccb * pccb)
  */
 static int ata_scsiop_read_capacity10(ccb *pccb)
 {
-       u8 buf[8];
+       u32 cap;
 
        if (!ataid[pccb->target]) {
                printf("scsi_ahci: SCSI READ CAPACITY10 command failure. "
@@ -611,14 +611,12 @@ static int ata_scsiop_read_capacity10(ccb *pccb)
                return -EPERM;
        }
 
-       memset(buf, 0, 8);
+       cap = le32_to_cpu(ataid[pccb->target]->lba_capacity);
+       memcpy(pccb->pdata, &cap, sizeof(cap));
 
-       *(u32 *) buf = le32_to_cpu(ataid[pccb->target]->lba_capacity);
-
-       buf[6] = 512 >> 8;
-       buf[7] = 512 & 0xff;
-
-       memcpy(pccb->pdata, buf, 8);
+       pccb->pdata[4] = pccb->pdata[5] = 0;
+       pccb->pdata[6] = 512 >> 8;
+       pccb->pdata[7] = 512 & 0xff;
 
        return 0;
 }