2.4.19 warnings cleanup
Subsystems (3)
PATCH 1/1 2.4.19 warnings cleanup
Hi,
The attached patch eliminates some compiler warning messages from various parts of the kernel. It disables some unused code (compressed ramdisk routines if no ramdisk support). Shouldn't break anything, but I wouldn't rather apply it in final rc-* stages...
2.4.19 only.
Signature · 2 lines
Krzysztof Halasa Network Administrator
drivers/char/agp/agpgart_be.c renamed from drivers/char/agp/agpgart_be.c.orig +1 -2
@@ -397,7 +397,7 @@static void agp_generic_agp_enable (u32 mode) {struct pci_dev *device =NULL ; -u32 command, scratch, cap_id; +u32 command, scratch;u8 cap_ptr; pci_read_config_dword(agp_bridge.dev,
@@ -4295,7 +4295,6 @@ {struct pci_dev *dev =NULL ;u8 cap_ptr =0x00 ; -u32 cap_id, scratch;if ((dev =pci_find_class (PCI_CLASS_BRIDGE_HOST <<8 ,NULL )) ==NULL )return -ENODEV ;
arch/i386/kernel/dmi_scan.c renamed from arch/i386/kernel/dmi_scan.c.orig +5 -3
@@ -186,12 +186,13 @@#define MATCH (a,b) { a, b }/* -* We have problems with IDE DMA on some platforms. In paticular the +* We have problems with IDE DMA on some platforms. In particular the * KT7 series. On these it seems the newer BIOS has fixed them. The * rule needs to be improved to match specific BIOS revisions with * corruption problems -*/ - +*/ + +#if 0 static __init int disable_ide_dma (struct dmi_blacklist *d) {#ifdef CONFIG_BLK_DEV_IDE
@@ -204,6 +205,7 @@#endif return 0; } +#endif /* * Reboot options and system auto-detection code provided by
fs/dnotify.c renamed from fs/dnotify.c.orig +1 -1
@@ -135,7 +135,7 @@ }if (changed)redo_inode_mask (inode); -out: +write_unlock (&dn_lock); }
init/do_mounts.c renamed from init/do_mounts.c.orig +2 -0
@@ -882,6 +882,7 @@#define WSIZE 0x8000/* window size--must be a power of two, and */ /* at least 32K for zip's deflate method */ +#ifdef CONFIG_BLK_DEV_RAM static uch *inbuf;static uch *window;
@@ -1006,5 +1007,6 @@kfree (window);return result; } +#endif /* CONFIG_BLK_DEV_RAM */ #endif /* BUILD_CRAMDISK */
include/linux/namespace.h renamed from include/linux/namespace.h.orig +1 -0
@@ -38,5 +38,6 @@atomic_inc (&namespace->count); } +int __init init_rootfs (void );#endif #endif
drivers/net/ppp_generic.c renamed from drivers/net/ppp_generic.c.orig +1 -1
@@ -378,7 +378,7 @@ {struct ppp_file *pf = file->private_data;DECLARE_WAITQUEUE (wait, current); -ssize_t ret; +ssize_t ret =0 ;/* suppress compiler warning */ struct sk_buff *skb =0 ;if (pf ==0 )
arch/i386/kernel/setup.c renamed from arch/i386/kernel/setup.c.orig +2 -0
@@ -175,6 +175,8 @@static int disable_x86_fxsr__initdata =0 ;static int disable_x86_ht__initdata =0 ; +static int __init have_cpuid_p (void ); +int enable_acpi_smp_table;#if defined(CONFIG_AGP ) || defined(CONFIG_AGP_MODULE )
drivers/net/ppp_generic.c line 384
Quoted 11 lines
drivers/net/ppp_generic.c renamed from drivers/net/ppp_generic.c.orig +1
-1@@ -378,7 +378,7 @@ {struct ppp_file *pf = file->private_data;DECLARE_WAITQUEUE (wait, current); -ssize_t ret; +ssize_t ret =0 ;/* suppress compiler warning */ struct sk_buff *skb =0 ;if (pf ==0 )
Please don't do this. I'm regularly having to fix drivers where people hid bugs this way rather than working out if it was a real problem. If it is genuinely a compiler corner case then let the gcc folks know and comment it but leave the warning.
Quoted 10 lines · Alan Cox
Quoted 10 lines
drivers/net/ppp_generic.c renamed from drivers/net/ppp_generic.c.orig +1
-1@@ -378,7 +378,7 @@ {struct ppp_file *pf = file->private_data;DECLARE_WAITQUEUE (wait, current); -ssize_t ret; +ssize_t ret =0 ;/* suppress compiler warning */ struct sk_buff *skb =0 ;
Quoted 7 lines
drivers/net/ppp_generic.c line 384
Quoted 1 line
drivers/net/ppp_generic.c renamed from drivers/net/ppp_generic.c.orig +0
-0if (pf ==0 )Please don't do this. I'm regularly having to fix drivers where people hid bugs this way rather than working out if it was a real problem. If it is genuinely a compiler corner case then let the gcc folks know and comment it but leave the warning.
The code is in ppp_read actually OK; if you trace through the logic you can prove that ret is never actually used without being set first.
Paul.
Quoted 4 lines · Paul Mackerras
Quoted 4 lines
Quoted 4 lines
drivers/net/ppp_generic.c renamed from drivers/net/ppp_generic.c.orig +0
-0@@ -378,7 +378,7 @@ {
Quoted 8 lines
Quoted 6 lines
drivers/net/ppp_generic.c line 383
Quoted 6 lines
drivers/net/ppp_generic.c renamed from drivers/net/ppp_generic.c.orig +1
-1struct ppp_file *pf = file->private_data;DECLARE_WAITQUEUE (wait, current); -ssize_t ret; +ssize_t ret =0 ;/* suppress compiler warning */ struct sk_buff *skb =0 ;The code is in
ppp_readactually OK; if you trace through the logic you can prove that ret is never actually used without being set first.
That's right - that's exactly why I wrote "suppress compiler warning". It's just the compiler not smart enough (of course, i looked at the code paths and I'd just fix it if it was broken).
Anyway, it seems there are more places like that in the kernel tree, so, as Alan said, the correct thing to improve is the compiler (not even sure if gcc3 would print the warning, I'm using RH "2.96" gcc).
Signature · 2 lines
Krzysztof Halasa Network Administrator
drivers/net/ppp_generic.c line 381
Quoted 8 lines
drivers/net/ppp_generic.c renamed from drivers/net/ppp_generic.c.orig +1
-1@@ -378,7 +378,7 @@ {struct ppp_file *pf = file->private_data;DECLARE_WAITQUEUE (wait, current); -ssize_t ret; +ssize_t ret =0 ;/* suppress compiler warning */
Please don't do this. I'm regularly having to fix drivers where people hid bugs this way rather than working out if it was a real problem. If it is genuinely a compiler corner case then let the gcc folks know and comment it but leave the warning.
A compiler isn't able to work out the control flow which makes sure ret is indeed initialized on every path to a use. Solving such a problem is traveling salesman'ish :-)
for (;;) {
...
if (skb)
break;
...
set 'ret' to something
more break statements
}
if (skb == 0)
goto out; /* where 'ret' is used' */
set 'ret' to somethingSee? :-)
In article <[email protected]>, David S. Miller <[email protected]> wrote:
| A compiler isn't able to work out the control flow which | makes sure ret is indeed initialized on every path to | a use. Solving such a problem is traveling salesman'ish :-)
This is true, but on the other hand I don't see much virtue in taking the attitude that I'm sure the compiler is wrong to avoid the overhead of initializing the variable or clarifying the code.
I totally agree that there are cases in which the compiler can't be sure and the programmer is based on some outside assumptions of input values or whatever, but I don't mind making the code robust in cases other than innermost loops where I just can't fix it.
I'd rather set the initial value to NOTSET or NULL or some value which will clearly show if you are setting what you think you are. I've occasionally been surprised, particularly when trusting values passed into a procedure.
Just my take on reliable vs. fast.
Signature · 3 lines
bill davidsen <[email protected]> CTO, TMR Associates, Inc Doing interesting things with little computers since 1979.
Quoted 10 lines · Alan Cox
Quoted 10 lines
drivers/net/ppp_generic.c renamed from drivers/net/ppp_generic.c.orig +1
-1@@ -378,7 +378,7 @@ {struct ppp_file *pf = file->private_data;DECLARE_WAITQUEUE (wait, current); -ssize_t ret; +ssize_t ret =0 ;/* suppress compiler warning */ struct sk_buff *skb =0 ;
Quoted 7 lines
drivers/net/ppp_generic.c line 384
Quoted 1 line
drivers/net/ppp_generic.c renamed from drivers/net/ppp_generic.c.orig +0
-0if (pf ==0 )Please don't do this. I'm regularly having to fix drivers where people hid bugs this way rather than working out if it was a real problem. If it is genuinely a compiler corner case then let the gcc folks know and comment it but leave the warning.
Ok.
Signature · 2 lines
Krzysztof Halasa Network Administrator