From: Greg KH <gregkh@linuxfoundation.org>
To: Baokun Li <libaokun1@huawei.com>
Cc: rafael@kernel.org, linux-kernel@vger.kernel.org,
weiyongjun1@huawei.com, yuehaibing@huawei.com,
yangjihong1@huawei.com, yukuai3@huawei.com
Subject: Re: [PATCH -next] driver core: Remove set but not used variable 'no_warn'
Date: Thu, 27 May 2021 11:41:18 +0200 [thread overview]
Message-ID: <YK9pPlItu+l9OROk@kroah.com> (raw)
In-Reply-To: <20210527091453.3880695-1-libaokun1@huawei.com>
On Thu, May 27, 2021 at 05:14:53PM +0800, Baokun Li wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/base/module.c: In function 'module_create_drivers_dir':
> drivers/base/module.c:36:6: warning:
> variable ‘no_warn’ set but not used [-Wunused-but-set-variable]
>
> It never used since introduction.
>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
> ---
> drivers/base/module.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/module.c b/drivers/base/module.c
> index 46ad4d636731..07ecd66b12b0 100644
> --- a/drivers/base/module.c
> +++ b/drivers/base/module.c
> @@ -33,7 +33,6 @@ static void module_create_drivers_dir(struct module_kobject *mk)
> void module_add_driver(struct module *mod, struct device_driver *drv)
> {
> char *driver_name;
> - int no_warn;
> struct module_kobject *mk = NULL;
>
> if (!drv)
> @@ -59,12 +58,12 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
> return;
>
> /* Don't check return codes; these calls are idempotent */
> - no_warn = sysfs_create_link(&drv->p->kobj, &mk->kobj, "module");
> + sysfs_create_link(&drv->p->kobj, &mk->kobj, "module");
> driver_name = make_driver_name(drv);
> if (driver_name) {
> module_create_drivers_dir(mk);
> - no_warn = sysfs_create_link(mk->drivers_dir, &drv->p->kobj,
> - driver_name);
> + sysfs_create_link(mk->drivers_dir, &drv->p->kobj,
> + driver_name);
> kfree(driver_name);
> }
> }
> --
> 2.25.4
>
And now you have a build warning :(
Please always test-build your patches before sending them out.
greg k-h
next prev parent reply other threads:[~2021-05-27 9:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-27 9:14 [PATCH -next] driver core: Remove set but not used variable 'no_warn' Baokun Li
2021-05-27 9:41 ` Greg KH [this message]
2021-05-27 10:11 ` kernel test robot
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=YK9pPlItu+l9OROk@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=libaokun1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=weiyongjun1@huawei.com \
--cc=yangjihong1@huawei.com \
--cc=yuehaibing@huawei.com \
--cc=yukuai3@huawei.com \
/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