On Mon, Jun 05, 2017 at 10:09:24PM -0700, Jessica Yu wrote: > +++ Corentin Labbe [02/06/17 14:05 +0200]: > >This patch fix 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] > > int nowarn; > > > >Signed-off-by: Corentin Labbe <clabbe.montj...@gmail.com> > >--- > > kernel/module.c | 13 +++++++++---- > > 1 file changed, 9 insertions(+), 4 deletions(-) > > > >diff --git a/kernel/module.c b/kernel/module.c > >index e3e9dbba6a5b..aed902bcb4aa 100644 > >--- a/kernel/module.c > >+++ b/kernel/module.c > >@@ -1663,19 +1663,20 @@ static inline void remove_notes_attrs(struct module > >*mod) > > } > > #endif /* CONFIG_KALLSYMS */ > > > >-static void add_usage_links(struct module *mod) > >+static int add_usage_links(struct module *mod) > > { > >+ int ret = 0; > > #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, > >+ ret = sysfs_create_link(use->target->holders_dir, > > &mod->mkobj.kobj, mod->name); > > ret will get overwritten with each iteration of the loop; we should return > ret as soon as we hit an error (while making sure we unlock > module_mutex). >
Thanks, I will fix all reported errors. I just found also that in case of error, I need to "del_usage_links" Regards