public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] smc91111_eeprom: fix compile warning
@ 2009-11-09 21:19 Ben Warren
  2009-11-09 21:36 ` Mike Frysinger
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Warren @ 2009-11-09 21:19 UTC (permalink / raw)
  To: u-boot

smc91111_eeprom.c:278: warning: suggest parentheses around + or - in operand
smc91111_eeprom.c:281: warning: suggest parentheses around + or - in operand

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
---
 examples/standalone/smc91111_eeprom.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/standalone/smc91111_eeprom.c b/examples/standalone/smc91111_eeprom.c
index 89afc87..345b1ab 100644
--- a/examples/standalone/smc91111_eeprom.c
+++ b/examples/standalone/smc91111_eeprom.c
@@ -275,10 +275,10 @@ void print_macaddr (struct eth_device *dev)
 	printf ("Current MAC Address in SMSC91111 ");
 	SMC_SELECT_BANK (dev, 1);
 	for (i = 0; i < 5; i++) {
-		printf ("%02x:", SMC_inb (dev, ADDR0_REG + i));
+		printf ("%02x:", SMC_inb (dev, (ADDR0_REG + i)));
 	}
 
-	printf ("%02x\n", SMC_inb (dev, ADDR0_REG + 5));
+	printf ("%02x\n", SMC_inb (dev, (ADDR0_REG + 5)));
 
 	i = 0;
 	for (j = 0x20; j < 0x23; j++) {
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] smc91111_eeprom: fix compile warning
  2009-11-09 21:19 [U-Boot] [PATCH] smc91111_eeprom: fix compile warning Ben Warren
@ 2009-11-09 21:36 ` Mike Frysinger
  2009-11-09 21:41   ` Ben Warren
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2009-11-09 21:36 UTC (permalink / raw)
  To: u-boot

On Monday 09 November 2009 16:19:58 Ben Warren wrote:
> smc91111_eeprom.c:278: warning: suggest parentheses around + or - in
>  operand
>  smc91111_eeprom.c:281: warning: suggest parentheses around + or -
>  in operand
> 
>  	for (i = 0; i < 5; i++) {
> -		printf ("%02x:", SMC_inb (dev, ADDR0_REG + i));
> +		printf ("%02x:", SMC_inb (dev, (ADDR0_REG + i)));
>  	}

erm, this says to me that the SMC inb macro is broken.  it should be using 
paren when expanding the second argument.  so lets fix that instead.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091109/e62a8ad3/attachment.pgp 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] smc91111_eeprom: fix compile warning
  2009-11-09 21:36 ` Mike Frysinger
@ 2009-11-09 21:41   ` Ben Warren
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Warren @ 2009-11-09 21:41 UTC (permalink / raw)
  To: u-boot

Mike Frysinger wrote:
> On Monday 09 November 2009 16:19:58 Ben Warren wrote:
>   
>> smc91111_eeprom.c:278: warning: suggest parentheses around + or - in
>>  operand
>>  smc91111_eeprom.c:281: warning: suggest parentheses around + or -
>>  in operand
>>
>>  	for (i = 0; i < 5; i++) {
>> -		printf ("%02x:", SMC_inb (dev, ADDR0_REG + i));
>> +		printf ("%02x:", SMC_inb (dev, (ADDR0_REG + i)));
>>  	}
>>     
>
> erm, this says to me that the SMC inb macro is broken.  it should be using 
> paren when expanding the second argument.  so lets fix that instead.
> -mike
>   

Yeah, I see where it is:

#define SMC_inb(a,p)  ({ \
	unsigned int __p = (unsigned int)((a)->iobase + (p<<1)); \
	unsigned int __v = *(volatile unsigned short *)((__p) & ~2); \
	if (__p & 2) __v >>= 8; \
	else __v &= 0xff; \
	__v; })


(p<<1) --> ((p)<<1)

Thanks for pointing this out.  Patch coming up.

regards,
Ben

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-09 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-09 21:19 [U-Boot] [PATCH] smc91111_eeprom: fix compile warning Ben Warren
2009-11-09 21:36 ` Mike Frysinger
2009-11-09 21:41   ` Ben Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox