macb: fix compile warning
authorandreas.devel@googlemail.com <andreas.devel@googlemail.com>
Thu, 9 Jun 2011 02:08:46 +0000 (02:08 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Tue, 21 Jun 2011 20:26:22 +0000 (22:26 +0200)
This patch fixes following compile warning:

---8<---
macb.c: In function 'macb_write_hwaddr':
macb.c:525:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
--->8---

Signed-off-by: Andreas Bießmann <andreas.devel@gmail.com>
drivers/net/macb.c

index 72ea1fc11d6ac04d2f6108060b3aba9c9eaafa88..c63eea966af5c7f473e03c71c9950913ceb535d6 100644 (file)
@@ -522,9 +522,10 @@ static int macb_write_hwaddr(struct eth_device *dev)
        u16 hwaddr_top;
 
        /* set hardware address */
-       hwaddr_bottom = cpu_to_le32(*((u32 *)dev->enetaddr));
+       hwaddr_bottom = dev->enetaddr[0] | dev->enetaddr[1] << 8 |
+                       dev->enetaddr[2] << 16 | dev->enetaddr[3] << 24;
        macb_writel(macb, SA1B, hwaddr_bottom);
-       hwaddr_top = cpu_to_le16(*((u16 *)(dev->enetaddr + 4)));
+       hwaddr_top = dev->enetaddr[4] | dev->enetaddr[5] << 8;
        macb_writel(macb, SA1T, hwaddr_top);
        return 0;
 }