Skip to contentSkip to conversation

2.5.54 kill module.h compiler warnings

PATCH In review Mikael Pettersson 3 participants 3 messages Jan 2, 2003 – Jan 3, 2003 Module support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.54 kill module.h compiler warnings

Rusty,

Compiling kernel 2.5.54 with CONFIG_MODULES=n results in tons and tons of the following warnings:

include/linux/module.h:317: warning: statement with no effect include/linux/module.h:353: warning: statement with no effect

patch-2.5.54 changed *MOD_INC_USE_COUNT from macros to __deprecated functions, but also dropped the (void) casts in front of the try_module_get() calls. Without modules, try_module_get() is the constant 1, hence the warnings.

The patch below silences the warnings by adding back the missing (void) casts. Works for me.

/Mikael

include/linux/module.h renamed from include/linux/module.h.~1~ +2 -2
@@ -314,7 +314,7 @@
 	/*
 	 * Yes, we ignore the retval here, that's why it's deprecated.
 	 */
-	try_module_get(module);
+	(void)try_module_get(module);
 }
 
 static inline void __deprecated __MOD_DEC_USE_COUNT(struct module *module)
@@ -350,7 +350,7 @@
 	local_inc(&module->ref[get_cpu()].count);
 	put_cpu();
 #else
-	try_module_get(module);
+	(void)try_module_get(module);
 #endif
 }
 #define MOD_INC_USE_COUNT \
#1 lore raw
Quoted 2 lines · Mikael Pettersson

The patch below silences the warnings by adding back the missing (void) casts. Works for me.

Better to make try_module_get a real inline function.

r~

#2 lore raw
In reply to Mikael Pettersson

In message <[email protected]> you write:

Quoted 8 lines

Rusty,

Compiling kernel 2.5.54 with CONFIG_MODULES=n results in tons and tons of the following warnings:

include/linux/module.h:317: warning: statement with no effect include/linux/module.h:353: warning: statement with no effect

Quoted 7 lines

patch-2.5.54 changed *MOD_INC_USE_COUNT from macros to __deprecated functions, but also dropped the (void) casts in front of the try_module_get() calls. Without modules, try_module_get() is the constant 1, hence the warnings.

The patch below silences the warnings by adding back the missing (void) casts. Works for me.

I know, Christoph Hellwig changed this, and I believe RTH fixed it in his merge with Linus.

Thanks!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.