[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gOcLu1=Vn5uqRix=JXy2ucHZVDtiPcbMsaSYgrgf7pxg@mail.gmail.com>
Date: Thu, 18 Feb 2021 18:22:22 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Colin King <colin.king@...onical.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
kernel-janitors@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drivers/base/cpu: remove redundant initialization of
variable retval
On Wed, Feb 17, 2021 at 8:51 PM Colin King <colin.king@...onical.com> wrote:
>
> From: Colin Ian King <colin.king@...onical.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@...onical.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) {
> --
Powered by blists - more mailing lists