From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Colin King <colin.king@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
kernel-janitors@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers/base/cpu: remove redundant initialization of variable retval
Date: Thu, 18 Feb 2021 18:22:22 +0100 [thread overview]
Message-ID: <CAJZ5v0gOcLu1=Vn5uqRix=JXy2ucHZVDtiPcbMsaSYgrgf7pxg@mail.gmail.com> (raw)
In-Reply-To: <20210217195136.195789-1-colin.king@canonical.com>
On Wed, Feb 17, 2021 at 8:51 PM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable retval is being initialized with a value that is never read
> and it is being updated later with a new value. The initialization is
> redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/base/cpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 8f1d6569564c..2e834cd315d8 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -409,7 +409,7 @@ __cpu_device_create(struct device *parent, void *drvdata,
> const char *fmt, va_list args)
> {
> struct device *dev = NULL;
> - int retval = -ENODEV;
Might as well init it to -ENOMEM and drop the assignment below.
> + int retval;
>
> dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> if (!dev) {
> --
prev parent reply other threads:[~2021-02-18 18:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-17 19:51 [PATCH] drivers/base/cpu: remove redundant initialization of variable retval Colin King
2021-02-18 17:22 ` Rafael J. Wysocki [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='CAJZ5v0gOcLu1=Vn5uqRix=JXy2ucHZVDtiPcbMsaSYgrgf7pxg@mail.gmail.com' \
--to=rafael@kernel.org \
--cc=colin.king@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).