Skip to contentSkip to conversation

kernel/module.c: fix an unused goto label

PATCH Applied Américo Wang 3 participants 4 messages Mar 24, 2009 – Mar 29, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/module.c: fix an unused goto label

Label 'free_init' is only used when defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP), so move it inside to shut up gcc.

Cc Rusty Russell <[email protected]>

---

kernel/module.c +1 -1
index 1196f5d..df00a1b 100644
@@ -2288,8 +2288,8 @@ static noinline struct module *load_module(void __user *umod,
 	ftrace_release(mod->module_core, mod->core_size);
  free_unload:
 	module_unload_free(mod);
- free_init:
 #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
+ free_init:
 	percpu_modfree(mod->refptr);
 #endif
 	module_free(mod, mod->module_init);
#1 lore raw
Quoted 5 lines · Américo Wang

Label 'free_init' is only used when defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP), so move it inside to shut up gcc.

Cc Rusty Russell <[email protected]>

was already sent a week ago - see below.

Ingo

------------->

Quoted 1 line

From 67f5ca081c6ace125e8ccc76b8a7d99b091abaa7 Mon Sep 17 00:00:00 2001

From: Dmitri Vorobiev <[email protected]>
Date: Wed, 18 Mar 2009 23:49:26 +0200
Subject: [PATCH] modules: Restrict definition of a label in kernel/module.c

Impact: cleanup

In function 'load_module' in kernel/module.c, the label 'free_init' is used if and only if both CONFIG_MODULE_UNLOAD and CONFIG_SMP are defined. However, the label itself is defined unconditionally, which may produce the following warning:

kernel/module.c:2291: warning: label 'free_init' defined but not used

This patch fixes the warning by moving the label definition under an appropriate preprocessor construct.

---
 kernel/module.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/module.c +1 -1
index 1196f5d..df00a1b 100644
@@ -2288,8 +2288,8 @@ static noinline struct module *load_module(void __user *umod,
 	ftrace_release(mod->module_core, mod->core_size);
  free_unload:
 	module_unload_free(mod);
- free_init:
 #if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
+ free_init:
 	percpu_modfree(mod->refptr);
 #endif
 	module_free(mod, mod->module_init);
#3 lore raw
In reply to Américo Wang
Quoted 3 lines · On Wednesday 25 March 2009 02:37:19 Américo Wang wrote:

Label 'free_init' is only used when defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP), so move it inside to shut up gcc.

Thanks, applied!
Rusty.

#2 lore raw
In reply to Ingo Molnar
Quoted 11 lines · Ingo Molnar
Quoted 5 lines · Américo Wang

Label 'free_init' is only used when defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP), so move it inside to shut up gcc.

Cc Rusty Russell <[email protected]>

was already sent a week ago - see below.

Oh, OK then! Thanks for your point! Please ignore my patch. :)

Signature · 1 line
Do what you love, f**k the rest! F**k the regulations!