From: Bartosz Golaszewski <[email protected]>
nvmem_register() returns a pointer, not a long int. Use ERR_CAST() to
cast the struct gpio_desc pointer to struct nvmem_device.
Reported-by: kbuild test robot <[email protected]>
Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/nvmem/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 3e1c94c4eee8..408ce702347e 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -351,7 +351,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp",
GPIOD_OUT_HIGH);
if (IS_ERR(nvmem->wp_gpio))
- return PTR_ERR(nvmem->wp_gpio);
+ return ERR_CAST(nvmem->wp_gpio);
kref_init(&nvmem->refcnt);
--
2.23.0
pt., 10 sty 2020 o 09:24 Bartosz Golaszewski <[email protected]> napisał(a):
>
> From: Bartosz Golaszewski <[email protected]>
>
> nvmem_register() returns a pointer, not a long int. Use ERR_CAST() to
> cast the struct gpio_desc pointer to struct nvmem_device.
>
> Reported-by: kbuild test robot <[email protected]>
> Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
> Signed-off-by: Bartosz Golaszewski <[email protected]>
> ---
> drivers/nvmem/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 3e1c94c4eee8..408ce702347e 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -351,7 +351,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
> nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp",
> GPIOD_OUT_HIGH);
> if (IS_ERR(nvmem->wp_gpio))
> - return PTR_ERR(nvmem->wp_gpio);
> + return ERR_CAST(nvmem->wp_gpio);
>
>
> kref_init(&nvmem->refcnt);
> --
> 2.23.0
>
Srinivas: this fixes a bug introduced in a patch I took through the
at24 tree. With your ack I'll apply it as a follow-up.
Bart
Thanks for the patch.
On 10/01/2020 08:24, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <[email protected]>
>
> nvmem_register() returns a pointer, not a long int. Use ERR_CAST() to
> cast the struct gpio_desc pointer to struct nvmem_device.
>
> Reported-by: kbuild test robot <[email protected]>
> Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
> Signed-off-by: Bartosz Golaszewski <[email protected]>
> ---
Acked-by: Srinivas Kandagatla <[email protected]>
> drivers/nvmem/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 3e1c94c4eee8..408ce702347e 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -351,7 +351,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
> nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp",
> GPIOD_OUT_HIGH);
> if (IS_ERR(nvmem->wp_gpio))
> - return PTR_ERR(nvmem->wp_gpio);
> + return ERR_CAST(nvmem->wp_gpio);
>
>
> kref_init(&nvmem->refcnt);
>
pt., 10 sty 2020 o 11:16 Srinivas Kandagatla
<[email protected]> napisał(a):
>
> Thanks for the patch.
>
> On 10/01/2020 08:24, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <[email protected]>
> >
> > nvmem_register() returns a pointer, not a long int. Use ERR_CAST() to
> > cast the struct gpio_desc pointer to struct nvmem_device.
> >
> > Reported-by: kbuild test robot <[email protected]>
> > Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
> > Signed-off-by: Bartosz Golaszewski <[email protected]>
> > ---
>
> Acked-by: Srinivas Kandagatla <[email protected]>
>
Thanks. This is rather uncontroversial, so applied right away.
Bart