Re: voyager_{thread,cat}.c compile warnings

From: Cédric Augonnet
Date: Sun Jul 22 2007 - 18:49:54 EST


2007/7/22, Cédric Augonnet <cedric.augonnet@xxxxxxxxx>:
Hi,

2007/7/21, Gabriel C <nix.or.die@xxxxxxxxxxxxxx>:
> 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.
>

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.

>
> 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
>

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.

>
>
> Regards,
>
> Gabriel C
>

Cheers,
Cédric



(forgot to cc the maintainer, sorry ...) Submitted by: Cedric Augonnet <cedric.augonnet@xxxxxxxxxxxx>
---
diff -urN a/arch/i386/mach-voyager/voyager_cat.c b/arch/i386/mach-voyager/voyager_cat.c
--- /home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-20 11:50:17.000000000 -0400
+++ linux-2.6.22/arch/i386/mach-voyager/voyager_cat.c 2007-07-22 11:24:34.000000000 -0400
@@ -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;
diff -urN a/arch/i386/mach-voyager/voyager_thread.c b/arch/i386/mach-voyager/voyager_thread.c
--- /home/gonnet/tmp/linux-2.6.22/arch/i386/mach-voyager/voyager_thread.c 2007-07-20 11:50:17.000000000 -0400
+++ linux-2.6.22/arch/i386/mach-voyager/voyager_thread.c 2007-07-22 11:27:13.000000000 -0400
@@ -92,7 +92,7 @@
}
}

-static int
+static void
thread(void *unused)
{
printk(KERN_NOTICE "Voyager starting monitor thread\n");