diff mbox

[U-Boot] 8xx: Fix build warnings

Message ID 1362768757-11425-1-git-send-email-wd@denx.de
State Superseded
Headers show

Commit Message

Wolfgang Denk March 8, 2013, 6:52 p.m. UTC
MPC8xx based systems throw this warning:

cpu.c:81:2: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]

Fix it.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>
---
 arch/powerpc/cpu/mpc8xx/cpu.c        | 4 +++-
 arch/powerpc/include/asm/8xx_immap.h | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Wolfgang Denk March 8, 2013, 9:18 p.m. UTC | #1
Hi,

In message <1362768757-11425-1-git-send-email-wd@denx.de> you wrote:
> MPC8xx based systems throw this warning:
> 
> cpu.c:81:2: warning: dereferencing type-punned pointer will break
> strict-aliasing rules [-Wstrict-aliasing]
> 
> Fix it.

I withdraw this patch in favour of Scott's older and more complete 
patch http://patchwork.ozlabs.org/patch/210599/

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index b6b733d..f48d602 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu.c
@@ -78,7 +78,9 @@  static int check_CPU (long clock, uint pvr, uint immr)
 	if ((pvr >> 16) != 0x0050)
 		return -1;
 
-	k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
+	k = (immr << 16) |
+	    immap->im_cpm.cp_dparam[PROFF_REVNUM] << 8 |
+	    immap->im_cpm.cp_dparam[PROFF_REVNUM + 1]  ;
 	m = 0;
 	suf = "";
 
diff --git a/arch/powerpc/include/asm/8xx_immap.h b/arch/powerpc/include/asm/8xx_immap.h
index 40679cb..3b29b39 100644
--- a/arch/powerpc/include/asm/8xx_immap.h
+++ b/arch/powerpc/include/asm/8xx_immap.h
@@ -488,6 +488,11 @@  typedef struct comm_proc {
 	u_char	cp_dparam[0x400];	/* Parameter RAM */
 } cpm8xx_t;
 
+/*
+ * Parameter RAM offsets from the base.
+ */
+#define PROFF_REVNUM		((uint)0x00B0)
+
 /* Internal memory map.
 */
 typedef struct immap {