diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2009-07-13 14:24:00 (GMT) |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-07-23 19:04:58 (GMT) |
commit | cb6d0b72c2c4f13c0075a7ae92e11682ec94a311 (patch) | |
tree | 810a61721ecd7c9d3b5e3905f1d90cb9211c9d7e /drivers | |
parent | 51d91e1a253c97713c7f3e5c0b910a4db4979283 (diff) | |
download | u-boot-cb6d0b72c2c4f13c0075a7ae92e11682ec94a311.tar.xz |
ahci: Fix gcc 4.4 compiler warning
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/ahci.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index e1b66fd..b0d1792 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -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; } |