From patchwork Mon Jul 8 18:23:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Denk X-Patchwork-Id: 257586 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id F1CA12C02A3 for ; Tue, 9 Jul 2013 04:23:27 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D62DE4A54B; Mon, 8 Jul 2013 20:23:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T2yzNneDlQXM; Mon, 8 Jul 2013 20:23:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 216C14A544; Mon, 8 Jul 2013 20:23:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 079E24A544 for ; Mon, 8 Jul 2013 20:23:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CNuo2udk1FIv for ; Mon, 8 Jul 2013 20:23:17 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=SKIP(-1.5) (only DNSBL check requested) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by theia.denx.de (Postfix) with ESMTPS id D3D3F4A538 for ; Mon, 8 Jul 2013 20:23:16 +0200 (CEST) Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3bpw5H6w3qz4KK3X; Mon, 8 Jul 2013 20:23:15 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3bpw5H5djlzbcBV; Mon, 8 Jul 2013 20:23:15 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from smtp-auth.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id PArULGb7T7CS; Mon, 8 Jul 2013 20:23:14 +0200 (CEST) X-Auth-Info: vdcMArpprSUvjg72e1skuMHJGGFnFycvClTiTpZZ3fA= Received: from diddl.denx.de (host-80-81-18-216.customer.m-online.net [80.81.18.216]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA; Mon, 8 Jul 2013 20:23:14 +0200 (CEST) Received: from gemini.denx.de (gemini.denx.de [10.0.0.2]) by diddl.denx.de (Postfix) with ESMTP id 505E71A77BD; Mon, 8 Jul 2013 20:23:09 +0200 (CEST) Received: by gemini.denx.de (Postfix, from userid 500) id 45351381233; Mon, 8 Jul 2013 20:23:14 +0200 (MEST) From: Wolfgang Denk To: u-boot@lists.denx.de Date: Mon, 8 Jul 2013 20:23:11 +0200 Message-Id: <1373307791-11436-1-git-send-email-wd@denx.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: References: Replied: Thu, 27 Jun 2013 08:22:34 +0200 Replied: Kim Phillips Replied: u-boot@lists.denx.de Replied: Michael Barkowski Replied: Andy Fleming Replied: Fri, 14 Jun 2013 11:14:07 +0200 Replied: Kim Phillips Replied: u-boot@lists.denx.de X-Original-To: wd@denx.de Cc: Kim Phillips , Timur Tabi Subject: [U-Boot] [PATCH 2/2 V2] PPC MPC83xx: Fix MPC8323ERDB build warning X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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: Timur Tabi cc: Kim Phillips --- V2: use uint32_t for crc_buf to make sure we always get exactly 32 bit; 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(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)) {