[U-Boot] [PATCH] GCC4.4: Squash multiple warnings due to strict aliasing

Marek Vasut marek.vasut at gmail.com
Mon Sep 26 04:06:38 CEST 2011


Signed-off-by: Marek Vasut <marek.vasut at gmail.com>
---
 arch/arm/include/asm/io.h |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 1fbc531..61f4987 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -78,43 +78,49 @@ static inline phys_addr_t virt_to_phys(void * vaddr)
 extern inline void __raw_writesb(unsigned int addr, const void *data, int bytelen)
 {
 	uint8_t *buf = (uint8_t *)data;
-	while(bytelen--)
-		__arch_putb(*buf++, addr);
+	int i;
+	for (i = 0; i < bytelen; i++)
+		__arch_putb(buf[i], addr);
 }
 
 extern inline void __raw_writesw(unsigned int addr, const void *data, int wordlen)
 {
 	uint16_t *buf = (uint16_t *)data;
-	while(wordlen--)
-		__arch_putw(*buf++, addr);
+	int i;
+	for (i = 0; i < wordlen; i++)
+		__arch_putw(buf[i], addr);
 }
 
 extern inline void __raw_writesl(unsigned int addr, const void *data, int longlen)
 {
 	uint32_t *buf = (uint32_t *)data;
-	while(longlen--)
-		__arch_putl(*buf++, addr);
+	int i;
+	for (i = 0; i < longlen; i++)
+		__arch_putl(buf[i], addr);
 }
 
 extern inline void __raw_readsb(unsigned int addr, void *data, int bytelen)
 {
 	uint8_t *buf = (uint8_t *)data;
-	while(bytelen--)
-		*buf++ = __arch_getb(addr);
+	int i;
+	for (i = 0; i < bytelen; i++)
+		buf[i] = __arch_getb(addr);
 }
 
 extern inline void __raw_readsw(unsigned int addr, void *data, int wordlen)
 {
 	uint16_t *buf = (uint16_t *)data;
-	while(wordlen--)
-		*buf++ = __arch_getw(addr);
+	int i;
+	for (i = 0; i < wordlen; i++)
+		buf[i] = __arch_getw(addr);
 }
 
 extern inline void __raw_readsl(unsigned int addr, void *data, int longlen)
 {
 	uint32_t *buf = (uint32_t *)data;
-	while(longlen--)
-		*buf++ = __arch_getl(addr);
+	int i;
+	for (i = 0; i < longlen; i++)
+		buf[i] = __arch_getl(addr);
 }
 
 #define __raw_writeb(v,a)	__arch_putb(v,a)
-- 
1.7.5.4



More information about the U-Boot mailing list