[U-Boot] [PATCH 2/2 V3] PPC MPC83xx: Fix MPC8323ERDB build warning

2013-07-14 Thread Wolfgang Denk
Fix:

mpc8323erdb.c: In function 'mac_read_from_eeprom':
mpc8323erdb.c:198:3: warning: dereferencing type-punned pointer will
break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Wolfgang Denk w...@denx.de
cc: Timur Tabi ti...@tabi.org
cc: Kim Phillips kim.phill...@freescale.com
---
V2: use uint32_t for crc_buf to make sure we always get exactly
32 bit; thanks to Timur Tabi for pointing out.
V3: also use uint32_t for the size of the memcpy(), again thanks to
Timur Tabi for pointing out.

 board/freescale/mpc8323erdb/mpc8323erdb.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c 
b/board/freescale/mpc8323erdb/mpc8323erdb.c
index f29b2f4..533cb08 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -195,7 +195,11 @@ int mac_read_from_eeprom(void)
printf(\nEEPROM @ 0x%02x read FAILED!!!\n,
   CONFIG_SYS_I2C_EEPROM_ADDR);
} else {
-   if (crc32(crc, buf, 24) == *(unsigned int *)buf[24]) {
+   uint32_t crc_buf;
+
+   memcpy(crc_buf, buf[24], sizeof(uint32_t));
+
+   if (crc32(crc, buf, 24) == crc_buf) {
printf(Reading MAC from EEPROM\n);
for (i = 0; i  4; i++) {
if (memcmp(buf[i * 6], \0\0\0\0\0\0, 6)) {
-- 
1.7.11.7

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2 V3] PPC MPC83xx: Fix MPC8323ERDB build warning

2013-07-14 Thread Timur Tabi

Wolfgang Denk wrote:

mpc8323erdb.c: In function 'mac_read_from_eeprom':
mpc8323erdb.c:198:3: warning: dereferencing type-punned pointer will
break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Wolfgang Denkw...@denx.de
cc: Timur Tabiti...@tabi.org
cc: Kim Phillipskim.phill...@freescale.com


Ack.

--
Timur Tabi
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot