[U-Boot] [PATCH 6/6] IXP: Fix NAND build warning on PDNB3 and SCPU

Marek Vasut marex at denx.de
Tue Mar 6 01:13:01 CET 2012


nand.c: In function ‘pdnb3_nand_read_buf’:
nand.c:107:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
nand.c: In function ‘pdnb3_nand_dev_ready’:
nand.c:124:18: warning: variable ‘val’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Bryan Hundven <bryanhundven at gmail.com>
Cc: Michael Schwingen <rincewind at discworld.dascon.de>
---
 board/prodrive/pdnb3/nand.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/board/prodrive/pdnb3/nand.c b/board/prodrive/pdnb3/nand.c
index 2efe027..656fafe 100644
--- a/board/prodrive/pdnb3/nand.c
+++ b/board/prodrive/pdnb3/nand.c
@@ -100,11 +100,14 @@ static void pdnb3_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 		for (i = 0; i < len; i++)
 			buf[i] = readb(&(pdnb3_ndfc->data));
 	} else {
-		ulong *ptr = (ulong *)buf;
+		uint32_t data;
 		int count = len >> 2;
 
-		for (i = 0; i < count; i++)
-			*ptr++ = readl(&(pdnb3_ndfc->data));
+		for (i = 0; i < count; i++) {
+			data = readl(&pdnb3_ndfc->data);
+			memcpy(buf, &data, 4);
+			buf += 4;
+		}
 	}
 }
 
-- 
1.7.9



More information about the U-Boot mailing list