voyager_{thread,cat}.c compile warnings
Hi,
I noticed this warnings on current git:
...
arch/i386/mach-voyager/voyager_thread.c: In function 'thread':arch/i386/mach-voyager/voyager_thread.c:113: warning: no return statement in function returning non-void
...
I think return 0; is missing on line 112 here.
...
arch/i386/mach-voyager/voyager_cat.c: In function 'voyager_cat_init':arch/i386/mach-voyager/voyager_cat.c:685: warning: comparison is always false due to limited range of data type arch/i386/mach-voyager/voyager_cat.c:755: warning: comparison is always false due to limited range of data type
...
Regards,
Gabriel C
Hi,
2007/7/21, Gabriel C <[email protected]>:
Quoted 5 lines
Hi,
I noticed this warnings on current git:
Quoted 9 lines
...
arch/i386/mach-voyager/voyager_thread.c: In function 'thread':arch/i386/mach-voyager/voyager_thread.c:113: warning: no return statement in function returning non-void...
I think return 0; is missing on line 112 here.
I guess there is no use in always returning 0, simply not returning anything and putting a void type might be cleaner, especially as this function seems to never
return.
Quoted 5 lines
arch/i386/mach-voyager/voyager_cat.c: In function 'voyager_cat_init':arch/i386/mach-voyager/voyager_cat.c:685: warning: comparison is always false due to limited range of data typearch/i386/mach-voyager/voyager_cat.c:755: warning: comparison is always false due to limited range of data type
Hum perhaps it does not like the comparision of a __u16 and an unsigned int ?
I enclose some dummy patch that should perhaps solve these issues, could not test it as i don't have the hardware... just my 2 cents. Don't know if casting is an
acceptable workaround though.
Quoted 6 lines
Regards,
Gabriel C
Cheers,
Cédric
Submitted by: Cedric Augonnet <[email protected]>
---
arch/i386/mach-voyager/voyager_cat.c renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c +2 -2
@@ -682,7 +682,7 @@outb (VOYAGER_CAT_END ,CAT_CMD );continue ; } -if (eprom_size >sizeof (eprom_buf)) { +if ((unsigned )eprom_size >sizeof (eprom_buf)) {printk ("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n" , i, eprom_size);outb (VOYAGER_CAT_END ,CAT_CMD );continue ;
@@ -752,7 +752,7 @@outb (VOYAGER_CAT_END ,CAT_CMD );continue ; } -if (eprom_size >sizeof (eprom_buf)) { +if ((unsigned )eprom_size >sizeof (eprom_buf)) {printk ("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n" , i, eprom_size);outb (VOYAGER_CAT_END ,CAT_CMD );continue ;
arch/i386/mach-voyager/voyager_thread.c renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_thread.c +1 -1
@@ -92,7 +92,7 @@ } } -static int +static void thread (void *unused) {printk (KERN_NOTICE "Voyager starting monitor thread\n" );
2007/7/22, Cédric Augonnet <[email protected]>:
Quoted 38 lines
Hi,
2007/7/21, Gabriel C <[email protected]>:
Quoted 5 lines
Hi,
I noticed this warnings on current git:
Quoted 9 lines
...
arch/i386/mach-voyager/voyager_thread.c: In function 'thread':arch/i386/mach-voyager/voyager_thread.c:113: warning: no return statement in function returning non-void...
I think return 0; is missing on line 112 here.
I guess there is no use in always returning 0, simply not returning anything and putting a void type might be cleaner, especially as this function seems to never
return.Quoted 5 lines
arch/i386/mach-voyager/voyager_cat.c: In function 'voyager_cat_init':arch/i386/mach-voyager/voyager_cat.c:685: warning: comparison is always false due to limited range of data typearch/i386/mach-voyager/voyager_cat.c:755: warning: comparison is always false due to limited range of data typeHum perhaps it does not like the comparision of a
__u16and an unsigned int ?I enclose some dummy patch that should perhaps solve these issues, could not test it as i don't have the hardware... just my 2 cents. Don't know if casting is an
acceptable workaround though.Quoted 2 lines
Quoted 9 lines
Quoted 4 lines
Regards,
Gabriel C
Cheers,
Cédric
(forgot to cc the maintainer, sorry ...)
Submitted by: Cedric Augonnet <[email protected]>
---
arch/i386/mach-voyager/voyager_cat.c renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c +2 -2
@@ -682,7 +682,7 @@outb (VOYAGER_CAT_END ,CAT_CMD );continue ; } -if (eprom_size >sizeof (eprom_buf)) { +if ((unsigned )eprom_size >sizeof (eprom_buf)) {printk ("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n" , i, eprom_size);outb (VOYAGER_CAT_END ,CAT_CMD );continue ;
@@ -752,7 +752,7 @@outb (VOYAGER_CAT_END ,CAT_CMD );continue ; } -if (eprom_size >sizeof (eprom_buf)) { +if ((unsigned )eprom_size >sizeof (eprom_buf)) {printk ("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n" , i, eprom_size);outb (VOYAGER_CAT_END ,CAT_CMD );continue ;
arch/i386/mach-voyager/voyager_thread.c renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_thread.c +1 -1
@@ -92,7 +92,7 @@ } } -static int +static void thread (void *unused) {printk (KERN_NOTICE "Voyager starting monitor thread\n" );
arch/i386/mach-voyager/voyager_cat.c 2007-07-22 line 685
Quoted 11 lines · Cédric Augonnet
iff -urN
a/arch/i386/mach-voyager/voyager_cat.cb/arch/i386/mach-voyager/voyager_cat.carch/i386/mach-voyager/voyager_cat.c 2007-07-22 renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400 +0
-011:24:34.000000000 -0400
arch/i386/mach-voyager/voyager_cat.c 2007-07-22 renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400 +1
-1@@ -682,7 +682,7 @@ outb(VOYAGER_CAT_END, CAT_CMD); continue; } - if(eprom_size > sizeof(eprom_buf)) { + if((unsigned)eprom_size > sizeof(eprom_buf)) {
Actually, no. If gcc can deduce that the comparison is always false then I want it not to build the body of the if. The only thing I don't know how to do is to shut up the warning in this case. What you've done is make gcc pretend it doesn't know the if is always false.
Quoted 21 lines
arch/i386/mach-voyager/voyager_cat.c 2007-07-22 renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400 +0
-0printk("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n", i, eprom_size); outb(VOYAGER_CAT_END, CAT_CMD);continue;arch/i386/mach-voyager/voyager_cat.c 2007-07-22 renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400 +1
-1@@ -752,7 +752,7 @@ outb(VOYAGER_CAT_END, CAT_CMD); continue; } - if(eprom_size > sizeof(eprom_buf)) { + if((unsigned)eprom_size > sizeof(eprom_buf)) { printk("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n", i, eprom_size); outb(VOYAGER_CAT_END, CAT_CMD);continue;diff -urN
a/arch/i386/mach-voyager/voyager_thread.cb/arch/i386/mach-voyager/voyager_thread.c
---/home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_thread.c2007-07-20 11:50:17.000000000 -0400
+++linux-2.6.22/arch/i386/mach-voyager/voyager_thread.c2007-07-22
11:27:13.000000000 -0400
arch/i386/mach-voyager/voyager_cat.c 2007-07-22 line 98
Quoted 8 lines
arch/i386/mach-voyager/voyager_cat.c 2007-07-22 renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400 +1
-1@@ -92,7 +92,7 @@ } } -static int +static void thread(void *unused) { printk(KERN_NOTICE "Voyager starting monitor thread\n");
You didn't actually compile this, did you? Apparently the signature of the kthread_run function changed from returning void to returning int. Unfortunately the person who fixed this up forgot to add a return 0 at the end of the voyager thread() function .. which is the correct fix.
James
2007/7/22, James Bottomley <[email protected]>:
Quoted 42 lines · Cédric Augonnet
arch/i386/mach-voyager/voyager_cat.c 2007-07-22 line 685
Quoted 11 lines
iff -urN
a/arch/i386/mach-voyager/voyager_cat.cb/arch/i386/mach-voyager/voyager_cat.carch/i386/mach-voyager/voyager_cat.c 2007-07-22 renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400 +0
-011:24:34.000000000 -0400
arch/i386/mach-voyager/voyager_cat.c 2007-07-22 renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400 +1
-1@@ -682,7 +682,7 @@ outb(VOYAGER_CAT_END, CAT_CMD); continue; } - if(eprom_size > sizeof(eprom_buf)) { + if((unsigned)eprom_size > sizeof(eprom_buf)) {Actually, no. If gcc can deduce that the comparison is always false then I want it not to build the body of the if. The only thing I don't know how to do is to shut up the warning in this case. What you've done is make gcc pretend it doesn't know the if is always false.
Quoted 24 lines
arch/i386/mach-voyager/voyager_cat.c 2007-07-22 renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400 +0
-0printk("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n", i, eprom_size); outb(VOYAGER_CAT_END, CAT_CMD);continue;arch/i386/mach-voyager/voyager_cat.c 2007-07-22 renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400 +1
-1@@ -752,7 +752,7 @@ outb(VOYAGER_CAT_END, CAT_CMD); continue; } - if(eprom_size > sizeof(eprom_buf)) { + if((unsigned)eprom_size > sizeof(eprom_buf)) { printk("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n", i, eprom_size); outb(VOYAGER_CAT_END, CAT_CMD);continue;diff -urN
a/arch/i386/mach-voyager/voyager_thread.cb/arch/i386/mach-voyager/voyager_thread.c
---/home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_thread.c2007-07-20 11:50:17.000000000 -0400
+++linux-2.6.22/arch/i386/mach-voyager/voyager_thread.c2007-07-22
11:27:13.000000000 -0400arch/i386/mach-voyager/voyager_cat.c 2007-07-22 renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400 +0
-0@@ -92,7 +92,7 @@ } }
Quoted 10 lines
arch/i386/mach-voyager/voyager_cat.c 2007-07-22 line 98
Quoted 5 lines
arch/i386/mach-voyager/voyager_cat.c 2007-07-22 renamed from home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400 +1
-1-static int +static void thread(void *unused) { printk(KERN_NOTICE "Voyager starting monitor thread\n");You didn't actually compile this, did you? Apparently the signature of the
kthread_runfunction changed from returning void to returning int. Unfortunately the person who fixed this up forgot to add a return 0 at the end of the voyagerthread()function .. which is the correct fix.
Arg i was caught by that one.
Quoted 2 lines
James
Ouch indeed this quick'n'dirty patch was, let's call it a full mistake :) sorry for that, it could indeed not be tested as i don't have the hardware.
Still, is it safe to compare two variable with different types anyway ?
In http://lists.infradead.org/pipermail/linux-pcmcia/2004-March/000586.html
they also have the same issue, they just do
s/ foo > 0xffff / foo & ~0xffff /
should not it solve the problem as well ?
Sorry again for the first patch, next time i'll just shut up.
Regards,
Cédric