Patchwork [U-Boot,2/4] mpc8xx: Correct cast of im_cpm.cp_dparam

login
register
mail settings
Submitter Tom Rini
Date May 13, 2013, 8:31 p.m.
Message ID <1368477117-32669-2-git-send-email-trini@ti.com>
Download mbox | patch
Permalink /patch/243530/
State Changes Requested
Delegated to: Wolfgang Denk
Headers show

Comments

Tom Rini - May 13, 2013, 8:31 p.m.
We must cast this to unsigned char not unsigned short to avoid warnings.

Cc: Wolfgang Denk <wd@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
---
 arch/powerpc/cpu/mpc8xx/cpu.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Wolfgang Denk - May 13, 2013, 10:34 p.m.
Dear Tom Rini,

In message <1368477117-32669-2-git-send-email-trini@ti.com> you wrote:
> We must cast this to unsigned char not unsigned short to avoid warnings.

But this is wrong.  We're actually reading a 16 bit value here.

I think there was previous discussion, and Scott Wodd has a patch out
there, which just needed some minor fixing...

Best regards,

Wolfgang Denk
Wolfgang Denk - May 14, 2013, 10:26 a.m.
Dear Tom,

In message <20130513223447.5D86C3804AF@gemini.denx.de> I wrote:
> 
> In message <1368477117-32669-2-git-send-email-trini@ti.com> you wrote:
> > We must cast this to unsigned char not unsigned short to avoid warnings.
> 
> But this is wrong.  We're actually reading a 16 bit value here.
> 
> I think there was previous discussion, and Scott Wodd has a patch out
> there, which just needed some minor fixing...

Scott's patch is here:

http://patchwork.ozlabs.org/patch/210599/

Scott, do you have any plans to submit an updated version?

Best regards,

Wolfgang Denk
Tom Rini - May 14, 2013, 1:14 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/13/2013 06:34 PM, Wolfgang Denk wrote:
> Dear Tom Rini,
> 
> In message <1368477117-32669-2-git-send-email-trini@ti.com> you
> wrote:
>> We must cast this to unsigned char not unsigned short to avoid
>> warnings.
> 
> But this is wrong.  We're actually reading a 16 bit value here.

Oh derp, I was mis-recalling the type rules here.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRkji2AAoJENk4IS6UOR1WoPUP/jaVGG2jSUGwsSWqCeWDuPu3
dWzu7CjqA01/pzhKYcJ/EBHTGuWaE0kQR7EHP0jhWFU+S20jIHaLqrRyznBnaHFJ
wsqsmyRhzgBEDq6oj6sKJa2OW+iVy6jkPlK3zRQJy9n9PpqdCW2u6b57dtCFq2tf
0f+GQDqwV2v3l5IOCWJfX5VeIJG1udBfKXGm1zNdEgcM8smJMdJsPuUBfUvUkO6d
GSPp+G6DQLIwJpCX6LE5LZGCTbZIm5hPgBqds1PhSgy5AupOPwLIBeAjlxjOJ4JD
Pp1pAfE9KSGnKJhJ000/24/74WAPOhvHVIn/9q8DPSFJaL/sze3vtnmrWX2WpXmL
kujYQVo89iL7KbJmN/OdEsxVImnp6pSahc+od1sZTZQa+6vuBfu8uoRluEmcJLnf
5lMrqg5b+IUdB/pC7UA+w6RG+RZj930U/G+duBvKuUQSqTpNG9GSXA8FXjRToope
MlUNpREU9w+pbUpJUMtbA97INzshGOSHyZvZDz1yFP6gJNBK+V+Tkz2P0zv9JC6V
UWdrRcuKBZ+6uteKTc1NCukhx2XH90VdVe1y+OhVT9G+mcbTkQo3KQv4FSi7B8Nu
jaxutfTve+FWbDTeHSCw5GqrB/GyB5mB4rdOVN1Q8I8GmuBkK4azKnsbccjkWGTJ
oHSCaEruXuTw8CqRvRM/
=XAN7
-----END PGP SIGNATURE-----
Scott Wood - May 15, 2013, 11:16 p.m.
On 05/14/2013 05:26:19 AM, Wolfgang Denk wrote:
> Dear Tom,
> 
> In message <20130513223447.5D86C3804AF@gemini.denx.de> I wrote:
> >
> > In message <1368477117-32669-2-git-send-email-trini@ti.com> you  
> wrote:
> > > We must cast this to unsigned char not unsigned short to avoid  
> warnings.
> >
> > But this is wrong.  We're actually reading a 16 bit value here.
> >
> > I think there was previous discussion, and Scott Wodd has a patch  
> out
> > there, which just needed some minor fixing...
> 
> Scott's patch is here:
> 
> http://patchwork.ozlabs.org/patch/210599/
> 
> Scott, do you have any plans to submit an updated version?

I'll try to get to it soon.

-Scott

Patch

diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index b6b733d..db98e82 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu.c
@@ -78,7 +78,7 @@  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) | *((uchar *) & immap->im_cpm.cp_dparam[0xB0]);
 	m = 0;
 	suf = "";
 
@@ -194,7 +194,7 @@  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) | *((uchar *) & immap->im_cpm.cp_dparam[0xB0]);
 	m = 0;
 
 	switch (k) {
@@ -253,7 +253,7 @@  static int check_CPU (long clock, uint pvr, uint immr)
 	if ((pvr >> 16) != 0x0050)
 		return -1;
 
-	k = (immr << 16) | in_be16((ushort *)&immap->im_cpm.cp_dparam[0xB0]);
+	k = (immr << 16) | in_be16((uchar *)&immap->im_cpm.cp_dparam[0xB0]);
 	m = 0;
 
 	switch (k) {
@@ -312,7 +312,7 @@  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) | *((uchar *) & immap->im_cpm.cp_dparam[0xB0]);
 	m = 0;
 
 	switch (k) {