public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ahci: Fix gcc 4.4 compiler warning
Date: Mon, 13 Jul 2009 09:24:00 -0500	[thread overview]
Message-ID: <1247495041-8605-2-git-send-email-galak@kernel.crashing.org> (raw)
In-Reply-To: <1247495041-8605-1-git-send-email-galak@kernel.crashing.org>

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 |   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;
 }
-- 
1.6.0.6

  reply	other threads:[~2009-07-13 14:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-13 14:23 [U-Boot] [PATCH] drivers/bios_emulator: Fix gcc 4.4 compiler warning Kumar Gala
2009-07-13 14:24 ` Kumar Gala [this message]
2009-07-13 14:24   ` [U-Boot] [PATCH] dlmalloc: Ignore gcc4.4 compiler warnings Kumar Gala
2009-07-23  2:05     ` [U-Boot] gcc4.4 warning fix patches Kumar Gala
2009-07-23 19:06     ` [U-Boot] [PATCH] dlmalloc: Ignore gcc4.4 compiler warnings Wolfgang Denk
2009-07-24 16:40       ` Kenneth Johansson
2009-07-26 21:26         ` Wolfgang Denk
2009-07-28 22:52           ` Scott Wood
2009-07-29  5:47             ` Wolfgang Denk
2009-07-29  5:55               ` Kumar Gala
2009-07-29 12:53               ` Kenneth Johansson
2009-08-07  0:14               ` Kumar Gala
2009-07-23 19:05   ` [U-Boot] [PATCH] ahci: Fix gcc 4.4 compiler warning Wolfgang Denk
2009-07-23 19:03 ` [U-Boot] [PATCH] drivers/bios_emulator: " Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1247495041-8605-2-git-send-email-galak@kernel.crashing.org \
    --to=galak@kernel.crashing.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox