Skip to contentSkip to conversation

8xx: Fix build warnings

PATCH New Wolfgang Denk 1 participant 2 messages Mar 8, 2013 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 8xx: Fix build warnings

MPC8xx based systems throw this warning:

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

Fix it.

---
 arch/powerpc/cpu/mpc8xx/cpu.c        | 4 +++-
 arch/powerpc/include/asm/8xx_immap.h | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)
arch/powerpc/cpu/mpc8xx/cpu.c +3 -1
index b6b733d..f48d602 100644
@@ -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 = "";
 
arch/powerpc/include/asm/8xx_immap.h +5 -0
index 40679cb..3b29b39 100644
@@ -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 {
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 1/1 8xx: Fix build warnings

Hi,

Quoted 6 lines · In message <[email protected]> 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

Signature · 7 lines
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
Nearly everyone is in favor of going  to  heaven  but  too  many  are
hoping  they'll  live  long  enough  to see an easing of the entrance
requirements. Never appeal to a man's "better nature." he  might  not
have one.