From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: Jessica Yu <jeyu@redhat.com>
Cc: rusty@rustcorp.com.au, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel/module.c: fix warning about unused nowarn variable
Date: Tue, 6 Jun 2017 08:38:59 +0200 [thread overview]
Message-ID: <20170606063859.GB23763@Red> (raw)
In-Reply-To: <20170606050923.jnbqr6c53b4wjrpe@jeyu>
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
prev parent reply other threads:[~2017-06-06 6:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-02 12:05 [PATCH] kernel/module.c: fix warning about unused nowarn variable Corentin Labbe
2017-06-06 5:09 ` Jessica Yu
2017-06-06 6:38 ` Corentin Labbe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170606063859.GB23763@Red \
--to=clabbe.montjoie@gmail.com \
--cc=jeyu@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox