public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] drivers/net/e1000.c: Fix GCC 4.6 build warnings
@ 2011-12-20 15:49 Anatolij Gustschin
  2011-12-20 16:07 ` Moffett, Kyle D
  2011-12-20 17:36 ` [U-Boot] [PATCH v2] " Anatolij Gustschin
  0 siblings, 2 replies; 7+ messages in thread
From: Anatolij Gustschin @ 2011-12-20 15:49 UTC (permalink / raw)
  To: u-boot

Fix:
e1000.c: In function 'e1000_read_mac_addr':
e1000.c:1149:2: warning: dereferencing type-punned pointer
will break strict-aliasing rules [-Wstrict-aliasing]

e1000.c:1149:2: warning: dereferencing type-punned pointer
will break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 drivers/net/e1000.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 6b71bd9..54f6425 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -45,6 +45,7 @@ tested on both gig copper and gig fiber boards
  */
 
 #include "e1000.h"
+#include <asm/unaligned.h>
 
 #define TOUT_LOOP   100000
 
@@ -1146,7 +1147,8 @@ e1000_read_mac_addr(struct eth_device *nic)
 		nic->enetaddr[5] ^= 1;
 
 #ifdef CONFIG_E1000_FALLBACK_MAC
-	if ( *(u32*)(nic->enetaddr) == 0 || *(u32*)(nic->enetaddr) == ~0 ) {
+	if (get_unaligned_be32(nic->enetaddr) == 0 ||
+	    get_unaligned_be32(nic->enetaddr) == ~0) {
 		unsigned char fb_mac[NODE_ADDRESS_SIZE] = CONFIG_E1000_FALLBACK_MAC;
 
 		memcpy (nic->enetaddr, fb_mac, NODE_ADDRESS_SIZE);
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-12-20 22:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-20 15:49 [U-Boot] [PATCH] drivers/net/e1000.c: Fix GCC 4.6 build warnings Anatolij Gustschin
2011-12-20 16:07 ` Moffett, Kyle D
2011-12-20 17:20   ` Mike Frysinger
2011-12-20 17:26   ` Anatolij Gustschin
2011-12-20 17:36 ` [U-Boot] [PATCH v2] " Anatolij Gustschin
2011-12-20 17:44   ` Moffett, Kyle D
2011-12-20 22:21   ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox