Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1658390
| From | Corentin Labbe <clabbe.montjoie@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] kernel/module.c: fix warning about unused nowarn variable |
| Date | 2017-06-06 08:40 +0200 |
| Message-ID | <tPgjL-58I-7@gated-at.bofh.it> (permalink) |
| References | <tNTyV-RF-17@gated-at.bofh.it> <tPeUF-4oZ-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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.montjoie@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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] kernel/module.c: fix warning about unused nowarn variable Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-06-02 14:10 +0200
Re: [PATCH] kernel/module.c: fix warning about unused nowarn variable Jessica Yu <jeyu@redhat.com> - 2017-06-06 07:10 +0200
Re: [PATCH] kernel/module.c: fix warning about unused nowarn variable Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-06-06 08:40 +0200
csiph-web