[U-Boot] [PATCH] 8xx: Fix build warnings

Wolfgang Denk wd at denx.de
Fri Mar 8 19:52:37 CET 2013


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 at denx.de>
Cc: Andy Fleming <afleming at gmail.com>
---
 arch/powerpc/cpu/mpc8xx/cpu.c        | 4 +++-
 arch/powerpc/include/asm/8xx_immap.h | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

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 {
-- 
1.7.11.7



More information about the U-Boot mailing list