2003-09-18 06:23:07

by John Cherry

[permalink] [raw]
Subject: IA32 - 27 New warnings

drivers/cdrom/mcdx.h:180:2: warning: #warning You have not edited mcdx.h
drivers/cdrom/mcdx.h:181:2: warning: #warning Perhaps irq and i/o settings are wrong.
drivers/char/applicom.c:67: warning: `applicom_pci_tbl' defined but not used
drivers/char/watchdog/alim1535_wdt.c:320: warning: `ali_pci_tbl' defined but not used
drivers/ide/legacy/dtc2278.c:138: warning: `dtc2278_release' defined but not used
drivers/ide/legacy/pdc4030.c:307: warning: `return' with no value, in function returning non-void
drivers/ide/legacy/pdc4030.c:323: warning: control reaches end of non-void function
drivers/ide/legacy/umc8672.c:164: warning: `umc8672_release' defined but not used
drivers/media/video/zoran_card.c:148: warning: `zr36067_pci_tbl' defined but not used
drivers/message/fusion/mptscsih.c:6922: warning: `mptscsih_setup' defined but not used
drivers/net/acenic.c:135: warning: `acenic_pci_tbl' defined but not used
drivers/net/dgrs.c:123: warning: `dgrs_pci_tbl' defined but not used
drivers/net/hp100.c:287: warning: `hp100_pci_tbl' defined but not used
drivers/net/skfp/skfddi.c:185: warning: `skfddi_pci_tbl' defined but not used
drivers/net/tulip/winbond-840.c:149: warning: `version' defined but not used
drivers/net/wireless/arlan.c:26: warning: `probe' defined but not used
drivers/scsi/NCR53c406a.c:660: warning: initialization from incompatible pointer type
drivers/scsi/aha152x.c:397: warning: `id_table' defined but not used
drivers/scsi/dtc.c:187: warning: `dtc_setup' defined but not used
drivers/scsi/fd_mcs.c:311: warning: initialization from incompatible pointer type
drivers/scsi/g_NCR5380.c:925: warning: `id_table' defined but not used
drivers/scsi/gdth.c:868: warning: `gdthtable' defined but not used
drivers/usb/class/usb-midi.h:150: warning: `usb_midi_ids' defined but not used
sound/oss/ad1848.c:2967: warning: `id_table' defined but not used
sound/oss/cmpci.c:1465: warning: unused variable `s'
sound/oss/cmpci.c:2865: warning: `cmpci_pci_tbl' defined but not used
sound/oss/sb_common.c:523: warning: `check_region' is deprecated (declared at include/linux/ioport.h:117)


2003-09-18 13:34:52

by Jesper Juhl

[permalink] [raw]
Subject: Re: IA32 - 27 New warnings


On Wed, 17 Sep 2003, John Cherry wrote:

> drivers/ide/legacy/pdc4030.c:307: warning: `return' with no value, in function returning non-void
> drivers/ide/legacy/pdc4030.c:323: warning: control reaches end of non-void function

Below is a patch that silences those two warnings and (hopefully) does the
right thing (I'll attempt to deal with the other ones later today).

I've tried as best I could to work out the logic of what goes on in that
file, and I /think/ I got it right, but I don't have the hardware to test
if I broke something horribly, so someone more knowledgable than me is
needed to confirm the patch and preferably some brave soul with Promise
hardware to test it as well.

A little explanation of why I do what I do in the patch:
ide_probe_for_pdc4030() is called by pdc4030_mod_init() which test the
return value for a zero or nonzero value. In the case of a zero return
-ENODEV is returned, else 0 is returned. So, the first return in
ide_probe_for_pdc4030() that tests if (enable_promise_support == 0) should
as far as I can tell return zero indicating that no devices where found
(since none where probed for), thereby triggering the -ENODEV return in
pdc4030_mod_init(). Further down I removed the #ifdef MODULE around the
last return statement in the file since the function is supposed to be
returning int we need a return value in all cases even if it's never hit
to keep gcc happy, and I modified the return from always returning zero to
return retval, I then make the value of retval be 0 if the loop if the
call to setup_pdc4030() in the loop returns zero for all calls, and 1 if
that call returns 1 just a single time, thus the return value will only
trigger -ENODEV in the calling functions if none of the attempted setups
where successful. I hope that's the proper intended logic, and if it is
not then I would greatly appreciate it if someone could point out where
the flaw is in my reasoning.


diff -up linux-2.6.0-test5-orig/drivers/ide/legacy/pdc4030.c
linux-2.6.0-test5/drivers/ide/legacy/pdc4030.c
--- linux-2.6.0-test5-orig/drivers/ide/legacy/pdc4030.c 2003-09-08 21:50:06.000000000 +0200
+++ linux-2.6.0-test5/drivers/ide/legacy/pdc4030.c 2003-09-18 15:08:35.000000000 +0200
@@ -300,26 +300,25 @@ int __init detect_pdc4030(ide_hwif_t *hw
int __init ide_probe_for_pdc4030(void)
{
unsigned int index;
+ int retval = 0;
ide_hwif_t *hwif;

#ifndef MODULE
if (enable_promise_support == 0)
- return;
+ return 0;
#endif

for (index = 0; index < MAX_HWIFS; index++) {
hwif = &ide_hwifs[index];
if (hwif->chipset == ide_unknown && detect_pdc4030(hwif))
{
#ifndef MODULE
- setup_pdc4030(hwif);
+ retval |= setup_pdc4030(hwif);
#else
return setup_pdc4030(hwif);
#endif
}
}
-#ifdef MODULE
- return 0;
-#endif
+ return retval;
}

static void __exit release_pdc4030(ide_hwif_t *hwif, ide_hwif_t *mate)



Kind regards,

Jesper Juhl <[email protected]>

2003-09-18 13:48:10

by Arnd Bergmann

[permalink] [raw]
Subject: Re: IA32 - 27 New warnings

John Cherry wrote:

> drivers/char/applicom.c:67: warning: `applicom_pci_tbl' defined but not used
> drivers/char/watchdog/alim1535_wdt.c:320: warning: `ali_pci_tbl' defined but not used
> drivers/media/video/zoran_card.c:148: warning: `zr36067_pci_tbl' defined but not used
> drivers/net/acenic.c:135: warning: `acenic_pci_tbl' defined but not used
> drivers/net/dgrs.c:123: warning: `dgrs_pci_tbl' defined but not used
> drivers/net/hp100.c:287: warning: `hp100_pci_tbl' defined but not used
> drivers/net/skfp/skfddi.c:185: warning: `skfddi_pci_tbl' defined but not used
> drivers/scsi/aha152x.c:397: warning: `id_table' defined but not used
> drivers/scsi/dtc.c:187: warning: `dtc_setup' defined but not used
> drivers/scsi/g_NCR5380.c:925: warning: `id_table' defined but not used
> drivers/scsi/gdth.c:868: warning: `gdthtable' defined but not used
> drivers/usb/class/usb-midi.h:150: warning: `usb_midi_ids' defined but not used
> sound/oss/ad1848.c:2967: warning: `id_table' defined but not used
> sound/oss/cmpci.c:2865: warning: `cmpci_pci_tbl' defined but not used

Does this patch help?

Arnd <><

===== include/linux/module.h 1.68 vs edited =====
--- 1.68/include/linux/module.h Fri Jul 4 00:00:09 2003
+++ edited/include/linux/module.h Thu Sep 18 15:26:23 2003
@@ -59,12 +59,12 @@
#define ___module_cat(a,b) __mod_ ## a ## b
#define __module_cat(a,b) ___module_cat(a,b)
#define __MODULE_INFO(tag, name, info) \
-static const char __module_cat(name,__LINE__)[] \
- __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
+static const char __module_cat(name,__LINE__)[] __attribute_used__ \
+ __attribute__((section(".modinfo"))) = __stringify(tag) "=" info

#define MODULE_GENERIC_TABLE(gtype,name) \
extern const struct gtype##_id __mod_##gtype##_table \
- __attribute__ ((unused, alias(__stringify(name))))
+ __attribute__ ((alias(__stringify(name))))

#define THIS_MODULE (&__this_module)

@@ -142,7 +142,8 @@
#define __CRC_SYMBOL(sym, sec) \
extern void *__crc_##sym __attribute__((weak)); \
static const unsigned long __kcrctab_##sym \
- __attribute__((section("__kcrctab" sec), unused)) \
+ __attribute_used__ \
+ __attribute__((section("__kcrctab" sec))) \
= (unsigned long) &__crc_##sym;
#else
#define __CRC_SYMBOL(sym, sec)
@@ -155,7 +156,8 @@
__attribute__((section("__ksymtab_strings"))) \
= MODULE_SYMBOL_PREFIX #sym; \
static const struct kernel_symbol __ksymtab_##sym \
- __attribute__((section("__ksymtab" sec), unused)) \
+ __attribute_used__ \
+ __attribute__((section("__ksymtab" sec))) \
= { (unsigned long)&sym, __kstrtab_##sym }

#define EXPORT_SYMBOL(sym) \

2003-09-18 15:47:04

by Randy.Dunlap

[permalink] [raw]
Subject: Re: IA32 - 27 New warnings

On Thu, 18 Sep 2003 15:33:21 +0200 (CEST) Jesper Juhl <[email protected]> wrote:

|
| On Wed, 17 Sep 2003, John Cherry wrote:
|
| > drivers/ide/legacy/pdc4030.c:307: warning: `return' with no value, in function returning non-void
| > drivers/ide/legacy/pdc4030.c:323: warning: control reaches end of non-void function
|
| Below is a patch that silences those two warnings and (hopefully) does the
| right thing (I'll attempt to deal with the other ones later today).
|
| I've tried as best I could to work out the logic of what goes on in that
| file, and I /think/ I got it right, but I don't have the hardware to test
| if I broke something horribly, so someone more knowledgable than me is
| needed to confirm the patch and preferably some brave soul with Promise
| hardware to test it as well.
|
| A little explanation of why I do what I do in the patch:

[snip]

Bart (IDE maintainer) has already posted patches for this.
See
http://marc.theaimsgroup.com/?l=linux-kernel&m=106329427503487&w=2

--
~Randy

2003-09-18 18:24:03

by Greg KH

[permalink] [raw]
Subject: Re: IA32 - 27 New warnings

On Wed, Sep 17, 2003 at 11:23:03PM -0700, John Cherry wrote:
> drivers/usb/class/usb-midi.h:150: warning: `usb_midi_ids' defined but not used

Hm, what compiler version are you using to get this warning?
This should not be happening (the usb_midi_ids are used in the
MODULE_DEVICE_TABLE() macro to export the info to userspace), and I
can't duplicate the warning here with gcc versions 3.3.1 or 2.96 (Red
Hat rawhide and Red Hat 7.3 respectively)

thanks,

greg k-h

2003-09-18 18:32:23

by Jasper Spaans

[permalink] [raw]
Subject: Re: IA32 - 27 New warnings

On Thu, Sep 18, 2003 at 08:40:11AM -0700, Randy.Dunlap wrote:

> Bart (IDE maintainer) has already posted patches for this.
> See
> http://marc.theaimsgroup.com/?l=linux-kernel&m=106329427503487&w=2

Which seems to invert some logic -- from the patch:

- return setup_pdc4030(hwif);
+ if (!setup_pdc4030(hwif))
+ return -ENODEV;
+ return 0;

(I cannot find any changes to setup_pdc4030() in that changeset)

VrGr,
--
Jasper Spaans http://jsp.vs19.net/
18:46:22 up 9710 days, 9:33, 0 users, load average: 12.80 10.76 10.63


Attachments:
(No filename) (636.00 B)
signature.asc (189.00 B)
Digital signature
Download all attachments

2003-09-18 20:41:10

by Jesper Juhl

[permalink] [raw]
Subject: Re: IA32 - 27 New warnings


On Thu, 18 Sep 2003, Randy.Dunlap wrote:

> On Thu, 18 Sep 2003 15:33:21 +0200 (CEST) Jesper Juhl <[email protected]> wrote:
>
> |
> | On Wed, 17 Sep 2003, John Cherry wrote:
> |
> | > drivers/ide/legacy/pdc4030.c:307: warning: `return' with no value, in function returning non-void
> | > drivers/ide/legacy/pdc4030.c:323: warning: control reaches end of non-void function
> |
> | Below is a patch that silences those two warnings and (hopefully) does the
> | right thing (I'll attempt to deal with the other ones later today).
> |
> | I've tried as best I could to work out the logic of what goes on in that
> | file, and I /think/ I got it right, but I don't have the hardware to test
> | if I broke something horribly, so someone more knowledgable than me is
> | needed to confirm the patch and preferably some brave soul with Promise
> | hardware to test it as well.
> |
> | A little explanation of why I do what I do in the patch:
>
> [snip]
>
> Bart (IDE maintainer) has already posted patches for this.
> See
> http://marc.theaimsgroup.com/?l=linux-kernel&m=106329427503487&w=2
>
So I see, and probably a lot better than what I managed to do (haven't
studied it in detail yet, but it looks a lot more comprehensive than my
little hack).
Ohh well, I had fun trying to sort out the problem and create a fix - now
I'm off looking for more resonably simple stuff to fix. :)


Jesper Juhl <[email protected]>

2003-09-18 20:46:46

by Jesper Juhl

[permalink] [raw]
Subject: Re: IA32 - 27 New warnings



On Thu, 18 Sep 2003, Greg KH wrote:

> On Wed, Sep 17, 2003 at 11:23:03PM -0700, John Cherry wrote:
> > drivers/usb/class/usb-midi.h:150: warning: `usb_midi_ids' defined but not used
>
> Hm, what compiler version are you using to get this warning?
> This should not be happening (the usb_midi_ids are used in the
> MODULE_DEVICE_TABLE() macro to export the info to userspace), and I
> can't duplicate the warning here with gcc versions 3.3.1 or 2.96 (Red
> Hat rawhide and Red Hat 7.3 respectively)
>
I just tested this with gcc 3.2.2 (Slackware Linux 9.0) and I do get that
warning :

gcc -Wp,-MD,drivers/usb/class/.usb-midi.o.d -D__KERNEL__ -Iinclude -Wall
-Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common
-pipe -mpreferred-stack-boundary=2 -march=i686
-Iinclude/asm-i386/mach-default -g -nostdinc -iwithprefix include
-DKBUILD_BASENAME=usb_midi -DKBUILD_MODNAME=usb_midi -c -o
drivers/usb/class/.tmp_usb-midi.o drivers/usb/class/usb-midi.c
drivers/usb/class/usb-midi.h:150: warning: `usb_midi_ids' defined but not
used



Jesper Juhl <[email protected]>


2003-09-18 20:52:39

by Greg KH

[permalink] [raw]
Subject: Re: IA32 - 27 New warnings

On Thu, Sep 18, 2003 at 10:45:18PM +0200, Jesper Juhl wrote:
>
>
> On Thu, 18 Sep 2003, Greg KH wrote:
>
> > On Wed, Sep 17, 2003 at 11:23:03PM -0700, John Cherry wrote:
> > > drivers/usb/class/usb-midi.h:150: warning: `usb_midi_ids' defined but not used
> >
> > Hm, what compiler version are you using to get this warning?
> > This should not be happening (the usb_midi_ids are used in the
> > MODULE_DEVICE_TABLE() macro to export the info to userspace), and I
> > can't duplicate the warning here with gcc versions 3.3.1 or 2.96 (Red
> > Hat rawhide and Red Hat 7.3 respectively)
> >
> I just tested this with gcc 3.2.2 (Slackware Linux 9.0) and I do get that
> warning :

Ah, it was pointed out to me offline, that if you build those drivers
into the kernel, and not as a module like I was doing, you will see
those warning messages.

thanks,

greg k-h