From: Wolfgang Denk Date: Thu, 27 Jun 2013 08:22:34 +0200 Subject: [U-Boot] [PATCH 2/2] PPC MPC83xx: Fix MPC8323ERDB build warning In-Reply-To: <1371198068-3581-1-git-send-email-wd@denx.de> References: <1371198068-3581-1-git-send-email-wd@denx.de> Message-ID: <20130627062234.7FDA6380468@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Kim, ping!! In message <1371198068-3581-1-git-send-email-wd@denx.de> I wrote: > 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 > cc: Michael Barkowski > cc: Kim Phillips > --- > 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]) { > + unsigned int crc_buf; > + > + memcpy(&crc_buf, &buf[24], sizeof(unsigned int)); > + > + 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 > Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer. - Fred Brooks, Jr.