public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] nvmem: core: fix return value
Date: Tue, 10 Jan 2023 16:50:05 +0000	[thread overview]
Message-ID: <d70e0b2f-4e13-a137-eaf7-b2c298926d85@linaro.org> (raw)
In-Reply-To: <E1pFHns-005syu-Df@rmk-PC.armlinux.org.uk>

Hi Russell,

On 10/01/2023 16:48, Russell King (Oracle) wrote:
> Dan Carpenter points out that the return code was not set in commit
> 60c8b4aebd8e ("nvmem: core: fix cleanup after dev_set_name()"), but
> this is not the only issue - we also need to zero wp_gpio to prevent
> gpiod_put() being called on an error value.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Fixes: 60c8b4aebd8e ("nvmem: core: fix cleanup after dev_set_name()")
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   drivers/nvmem/core.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 082cda7ac199..1ee2e9255f7b 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -781,8 +781,11 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
>   	if (!config->ignore_wp)
>   		nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp",
>   						    GPIOD_OUT_HIGH);
> -	if (IS_ERR(nvmem->wp_gpio))
> +	if (IS_ERR(nvmem->wp_gpio)) {
> +		rval = PTR_ERR(nvmem->wp_gpio);
> +		nvmem->wp_gpio = NULL;
>   		goto err_put_device;

I have already added this change while applying v3 patches.

thanks,

--srini
> +	}
>   
>   	kref_init(&nvmem->refcnt);
>   	INIT_LIST_HEAD(&nvmem->cells);

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-01-10 16:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 16:48 [PATCH] nvmem: core: fix return value Russell King (Oracle)
2023-01-10 16:50 ` Srinivas Kandagatla [this message]
2023-01-10 16:54   ` Russell King (Oracle)
2023-01-10 17:05     ` Srinivas Kandagatla

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=d70e0b2f-4e13-a137-eaf7-b2c298926d85@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=rmk+kernel@armlinux.org.uk \
    /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