Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1658725 > unrolled thread

[PATCH v2 0/2] suppress warning about unused nowarn variable

Started byCorentin Labbe <clabbe.montjoie@gmail.com>
First post2017-06-06 14:30 +0200
Last post2017-06-06 14:30 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/2] suppress warning about unused nowarn variable               Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-06-06 14:30 +0200
    [PATCH v2 1/2] kernel/module.c: Invert add_usage_link and del_usage_link functions Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-06-06 14:30 +0200

#1658725 — [PATCH v2 0/2] suppress warning about unused nowarn variable

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-06-06 14:30 +0200
Subject[PATCH v2 0/2] suppress warning about unused nowarn variable
Message-ID<tPlMv-hV-47@gated-at.bofh.it>
Hello                                                                           
                                                                                
This patch serie suppress the following warning:                                
kernel/module.c: In function 'add_usage_links':                                 
kernel/module.c:1653:6: warning: variable 'nowarn' set but not used [-Wunused-but-set-variable]
                                                                                
Changes since v1:                                                               
- renamed out_unreg_usage_links to out_unreg_modinfo_attrs                      
- added extra newline
- added missing call to del_usage_link() in case of add_usage_link() error      
- added patch #1

Corentin Labbe (2):
  kernel/module.c: Invert add_usage_link and del_usage_link functions
  kernel/module.c: suppress warning about unused nowarn variable

 kernel/module.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

-- 
2.13.0

[toc] | [next] | [standalone]


#1658727 — [PATCH v2 1/2] kernel/module.c: Invert add_usage_link and del_usage_link functions

FromCorentin Labbe <clabbe.montjoie@gmail.com>
Date2017-06-06 14:30 +0200
Subject[PATCH v2 1/2] kernel/module.c: Invert add_usage_link and del_usage_link functions
Message-ID<tPlMx-hV-71@gated-at.bofh.it>
In reply to#1658725
This patch just swap del_usage_link() before add_usage_link().

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 kernel/module.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index e3e9dbba6a5b..983b81f6d4ba 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1663,29 +1663,29 @@ static inline void remove_notes_attrs(struct module *mod)
 }
 #endif /* CONFIG_KALLSYMS */
 
-static void add_usage_links(struct module *mod)
+static void del_usage_links(struct module *mod)
 {
 #ifdef CONFIG_MODULE_UNLOAD
 	struct module_use *use;
-	int nowarn;
 
 	mutex_lock(&module_mutex);
-	list_for_each_entry(use, &mod->target_list, target_list) {
-		nowarn = sysfs_create_link(use->target->holders_dir,
-					   &mod->mkobj.kobj, mod->name);
-	}
+	list_for_each_entry(use, &mod->target_list, target_list)
+		sysfs_remove_link(use->target->holders_dir, mod->name);
 	mutex_unlock(&module_mutex);
 #endif
 }
 
-static void del_usage_links(struct module *mod)
+static void add_usage_links(struct module *mod)
 {
 #ifdef CONFIG_MODULE_UNLOAD
 	struct module_use *use;
+	int nowarn;
 
 	mutex_lock(&module_mutex);
-	list_for_each_entry(use, &mod->target_list, target_list)
-		sysfs_remove_link(use->target->holders_dir, mod->name);
+	list_for_each_entry(use, &mod->target_list, target_list) {
+		nowarn = sysfs_create_link(use->target->holders_dir,
+					   &mod->mkobj.kobj, mod->name);
+	}
 	mutex_unlock(&module_mutex);
 #endif
 }
-- 
2.13.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web