[U-Boot] [PATCH] smc91111_eeprom: fix compile warning

Ben Warren biggerbadderben at gmail.com
Mon Nov 9 22:41:03 CET 2009


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



More information about the U-Boot mailing list