public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] macb: fix compile warning
Date: Thu,  9 Jun 2011 13:33:08 +0200	[thread overview]
Message-ID: <1307619188-18655-1-git-send-email-andreas.devel@gmail.com> (raw)

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>
---
BEWARE! this patch is only copile tested!

 drivers/net/macb.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 72ea1fc..da41054 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -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 = netdev->enetaddr[0] | netdev->enetaddr[1] << 8 |
+			netdev->enetaddr[2] << 16 | netdev->enetaddr[3] << 24;
 	macb_writel(macb, SA1B, hwaddr_bottom);
-	hwaddr_top = cpu_to_le16(*((u16 *)(dev->enetaddr + 4)));
+	hwaddr_top = netdev->enetaddr[4] | netdev->enetaddr[5] << 8;
 	macb_writel(macb, SA1T, hwaddr_top);
 	return 0;
 }
-- 
1.7.2.5

             reply	other threads:[~2011-06-09 11:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09 11:33 Andreas Bießmann [this message]
2011-06-09 12:08 ` [U-Boot] [PATCH v2] macb: fix compile warning Andreas Bießmann
2011-06-09 19:02   ` Reinhard Meyer
2011-07-27 21:48 ` [U-Boot] [PATCH] " Wolfgang Denk
2011-07-27 21:55   ` Reinhard Meyer
2011-07-27 22:06     ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1307619188-18655-1-git-send-email-andreas.devel@gmail.com \
    --to=andreas.devel@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox