[U-Boot] [PATCH] macb: fix compile warning

Wolfgang Denk wd at denx.de
Wed Jul 27 23:48:56 CEST 2011


Dear "=?UTF-8?q?Andreas=20Bie=C3=9Fmann?=",

In message <1307619188-18655-1-git-send-email-andreas.devel at 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 at 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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"355/113 -- Not the famous irrational number PI,  but  an  incredible
simulation!"


More information about the U-Boot mailing list