diff mbox

[U-Boot] macb: fix compile warning

Message ID 1307619188-18655-1-git-send-email-andreas.devel@gmail.com
State Superseded
Delegated to: Reinhard Meyer
Headers show

Commit Message

Andreas Bießmann June 9, 2011, 11:33 a.m. UTC
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(-)

Comments

Wolfgang Denk July 27, 2011, 9:48 p.m. UTC | #1
Dear "=?UTF-8?q?Andreas=20Bie=C3=9Fmann?=",

In message <1307619188-18655-1-git-send-email-andreas.devel@gmail.com> you wrote:
> 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;

This doesn't apply.  Can you please rebase and resubmit?  Thanks.

Best regards,

Wolfgang Denk
Reinhard Meyer July 27, 2011, 9:55 p.m. UTC | #2
Dear Wolfgang Denk,
> Dear "=?UTF-8?q?Andreas=20Bie=C3=9Fmann?=",
>
> In message<1307619188-18655-1-git-send-email-andreas.devel@gmail.com>  you wrote:
>> 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>
> This doesn't apply.  Can you please rebase and resubmit?  Thanks.

V2 of this patch has been mainlined in June already.
Note: macb is the LAN driver for all Atmel ARM and AVR32 SoCs.

Best Regards,
Reinhard
Wolfgang Denk July 27, 2011, 10:06 p.m. UTC | #3
Dear Reinhard Meyer,

In message <4E30894C.1030509@emk-elektronik.de> you wrote:
>
> > This doesn't apply.  Can you please rebase and resubmit?  Thanks.
> 
> V2 of this patch has been mainlined in June already.

I see, thanks.

Best regards,

Wolfgang Denk
diff mbox

Patch

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;
 }