diff mbox

[U-Boot] board/eltec/elppc/misc.c: Fix GCC 4.6 build warning

Message ID 1324403469-3085-1-git-send-email-agust@denx.de
State Accepted
Headers show

Commit Message

Anatolij Gustschin Dec. 20, 2011, 5:51 p.m. UTC
Fix:
misc.c: In function 'misc_init_r':
misc.c:119:3: warning: dereferencing type-punned pointer
will break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 board/eltec/elppc/misc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Mike Frysinger Dec. 20, 2011, 6:21 p.m. UTC | #1
On Tuesday 20 December 2011 12:51:09 Anatolij Gustschin wrote:
> -		*(int *) &eerev.res[0] = 0;
> +		memset(&eerev.res[0], 0, 4);

&foo[0] is the same thing as foo
-mike
Wolfgang Denk Dec. 20, 2011, 10:21 p.m. UTC | #2
Dear Anatolij Gustschin,

In message <1324403469-3085-1-git-send-email-agust@denx.de> you wrote:
> Fix:
> misc.c: In function 'misc_init_r':
> misc.c:119:3: warning: dereferencing type-punned pointer
> will break strict-aliasing rules [-Wstrict-aliasing]
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  board/eltec/elppc/misc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/board/eltec/elppc/misc.c b/board/eltec/elppc/misc.c
index d476cd5..89f1b1d 100644
--- a/board/eltec/elppc/misc.c
+++ b/board/eltec/elppc/misc.c
@@ -116,7 +116,7 @@  int misc_init_r (void)
 		eerev.etheraddr[5] = 0x4D;
 
 		/* cache config word for ELPPC */
-		*(int *) &eerev.res[0] = 0;
+		memset(&eerev.res[0], 0, 4);
 
 		initSrom = 1;	/* force dialog */
 		copyNv = 1;	/* copy to nvram */