[U-Boot] [PATCH] dm: ppc: Fixup cpu.c warning in mpc8xx

Wolfgang Denk wd at denx.de
Fri Jul 27 22:56:44 CEST 2012


Dear Marek Vasut,

In message <1343419212-18716-1-git-send-email-marex at denx.de> you wrote:
> cpu.c: In function ‘check_CPU’:
> cpu.c:256:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
> 
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Wolfgang Denk <wd at denx.de>
> ---
>  arch/powerpc/cpu/mpc8xx/cpu.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
...
> -	k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
> +	k = (immr << 16) | readw(&immap->im_cpm.cp_dparam[0xB0]);

I think this is wrong.  readw() is a little endian I/O accessor, but
PPC is all big-endian.

Guess this was untested?

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
"The good Christian should beware of mathematicians and all those who
make empty prophecies. The danger already exists that  mathematicians
have  made a covenant with the devil to darken the spirit and confine
man in the bonds of Hell."                          - Saint Augustine


More information about the U-Boot mailing list