public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning
@ 2009-06-15 16:50 Kim Phillips
  2009-06-18  5:14 ` Ben Warren
  0 siblings, 1 reply; 4+ messages in thread
From: Kim Phillips @ 2009-06-15 16:50 UTC (permalink / raw)
  To: u-boot

fix this gcc 4.4 warning:

tsec.c: In function 'tsec_init':
tsec.c:200: warning: dereferencing type-punned pointer will break strict-aliasing rules

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
 drivers/net/tsec.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 399116f..40b3be4 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -197,7 +197,10 @@ int tsec_init(struct eth_device *dev, bd_t * bd)
 	for (i = 0; i < MAC_ADDR_LEN; i++) {
 		tmpbuf[MAC_ADDR_LEN - 1 - i] = dev->enetaddr[i];
 	}
-	regs->macstnaddr1 = *((uint *) (tmpbuf));
+	tempval = (tmpbuf[3] << 24) | (tmpbuf[2] << 16) | (tmpbuf[1] << 8) |
+		  tmpbuf[0];
+
+	regs->macstnaddr1 = tempval;
 
 	tempval = *((uint *) (tmpbuf + 4));
 
-- 
1.6.3.2

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

* [U-Boot] [PATCH] net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning
  2009-06-15 16:50 [U-Boot] [PATCH] net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning Kim Phillips
@ 2009-06-18  5:14 ` Ben Warren
       [not found]   ` <2acbd3e40906181519h8c14828pf167c0c197a6e828@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Warren @ 2009-06-18  5:14 UTC (permalink / raw)
  To: u-boot

Kim Phillips wrote:
> fix this gcc 4.4 warning:
>
> tsec.c: In function 'tsec_init':
> tsec.c:200: warning: dereferencing type-punned pointer will break strict-aliasing rules
>
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> ---
>  drivers/net/tsec.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
> index 399116f..40b3be4 100644
> --- a/drivers/net/tsec.c
> +++ b/drivers/net/tsec.c
> @@ -197,7 +197,10 @@ int tsec_init(struct eth_device *dev, bd_t * bd)
>  	for (i = 0; i < MAC_ADDR_LEN; i++) {
>  		tmpbuf[MAC_ADDR_LEN - 1 - i] = dev->enetaddr[i];
>  	}
> -	regs->macstnaddr1 = *((uint *) (tmpbuf));
> +	tempval = (tmpbuf[3] << 24) | (tmpbuf[2] << 16) | (tmpbuf[1] << 8) |
> +		  tmpbuf[0];
> +
> +	regs->macstnaddr1 = tempval;
>  
>  	tempval = *((uint *) (tmpbuf + 4));
>  
>   
Applied to net repo.

thanks,
Ben

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

* [U-Boot] [PATCH v2] net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning
       [not found]     ` <4A56D89D.2040900@gmail.com>
@ 2009-07-17 17:17       ` Kim Phillips
  2009-07-21  4:49         ` Ben Warren
  0 siblings, 1 reply; 4+ messages in thread
From: Kim Phillips @ 2009-07-17 17:17 UTC (permalink / raw)
  To: u-boot

fix this gcc 4.4 warning:

tsec.c: In function 'tsec_init':
tsec.c:200: warning: dereferencing type-punned pointer will break strict-aliasing rules

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
this is the endian-correct version

 drivers/net/tsec.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 63fc02e..5dc05e5 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -197,7 +197,10 @@ int tsec_init(struct eth_device *dev, bd_t * bd)
 	for (i = 0; i < MAC_ADDR_LEN; i++) {
 		tmpbuf[MAC_ADDR_LEN - 1 - i] = dev->enetaddr[i];
 	}
-	regs->macstnaddr1 = *((uint *) (tmpbuf));
+	tempval = (tmpbuf[0] << 24) | (tmpbuf[1] << 16) | (tmpbuf[2] << 8) |
+		  tmpbuf[3];
+
+	regs->macstnaddr1 = tempval;
 
 	tempval = *((uint *) (tmpbuf + 4));
 
-- 
1.6.3.3

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

* [U-Boot] [PATCH v2] net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning
  2009-07-17 17:17       ` [U-Boot] [PATCH v2] " Kim Phillips
@ 2009-07-21  4:49         ` Ben Warren
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Warren @ 2009-07-21  4:49 UTC (permalink / raw)
  To: u-boot

Kim,

Kim Phillips wrote:
> fix this gcc 4.4 warning:
>
> tsec.c: In function 'tsec_init':
> tsec.c:200: warning: dereferencing type-punned pointer will break strict-aliasing rules
>
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> ---
> this is the endian-correct version
>
>  drivers/net/tsec.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
> index 63fc02e..5dc05e5 100644
> --- a/drivers/net/tsec.c
> +++ b/drivers/net/tsec.c
> @@ -197,7 +197,10 @@ int tsec_init(struct eth_device *dev, bd_t * bd)
>  	for (i = 0; i < MAC_ADDR_LEN; i++) {
>  		tmpbuf[MAC_ADDR_LEN - 1 - i] = dev->enetaddr[i];
>  	}
> -	regs->macstnaddr1 = *((uint *) (tmpbuf));
> +	tempval = (tmpbuf[0] << 24) | (tmpbuf[1] << 16) | (tmpbuf[2] << 8) |
> +		  tmpbuf[3];
> +
> +	regs->macstnaddr1 = tempval;
>  
>  	tempval = *((uint *) (tmpbuf + 4));
>  
>   
Applied to net repo.

thanks,
Ben

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

end of thread, other threads:[~2009-07-21  4:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-15 16:50 [U-Boot] [PATCH] net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning Kim Phillips
2009-06-18  5:14 ` Ben Warren
     [not found]   ` <2acbd3e40906181519h8c14828pf167c0c197a6e828@mail.gmail.com>
     [not found]     ` <4A56D89D.2040900@gmail.com>
2009-07-17 17:17       ` [U-Boot] [PATCH v2] " Kim Phillips
2009-07-21  4:49         ` Ben Warren

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