linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] nvmem: fix a 'makes pointer from integer without a cast' build warning
@ 2020-01-10  8:24 Bartosz Golaszewski
  2020-01-10  8:26 ` Bartosz Golaszewski
  2020-01-10 10:16 ` Srinivas Kandagatla
  0 siblings, 2 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2020-01-10  8:24 UTC (permalink / raw)
  To: Srinivas Kandagatla, Linus Walleij, Khouloud Touil, Stephen Rothwell
  Cc: linux-kernel, Bartosz Golaszewski, kbuild test robot

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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 <lkp@intel.com>
Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] nvmem: fix a 'makes pointer from integer without a cast' build warning
  2020-01-10  8:24 [PATCH -next] nvmem: fix a 'makes pointer from integer without a cast' build warning Bartosz Golaszewski
@ 2020-01-10  8:26 ` Bartosz Golaszewski
  2020-01-10 10:16 ` Srinivas Kandagatla
  1 sibling, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2020-01-10  8:26 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Linux Kernel Mailing List, Stephen Rothwell, Khouloud Touil,
	Linus Walleij, Bartosz Golaszewski, kbuild test robot

pt., 10 sty 2020 o 09:24 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
>
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> 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 <lkp@intel.com>
> Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] nvmem: fix a 'makes pointer from integer without a cast' build warning
  2020-01-10  8:24 [PATCH -next] nvmem: fix a 'makes pointer from integer without a cast' build warning Bartosz Golaszewski
  2020-01-10  8:26 ` Bartosz Golaszewski
@ 2020-01-10 10:16 ` Srinivas Kandagatla
  2020-01-10 11:13   ` Bartosz Golaszewski
  1 sibling, 1 reply; 4+ messages in thread
From: Srinivas Kandagatla @ 2020-01-10 10:16 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij, Khouloud Touil, Stephen Rothwell
  Cc: linux-kernel, Bartosz Golaszewski, kbuild test robot

Thanks for the patch.

On 10/01/2020 08:24, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> 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 <lkp@intel.com>
> Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---

Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

>   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);
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] nvmem: fix a 'makes pointer from integer without a cast' build warning
  2020-01-10 10:16 ` Srinivas Kandagatla
@ 2020-01-10 11:13   ` Bartosz Golaszewski
  0 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2020-01-10 11:13 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Bartosz Golaszewski, Linus Walleij, Khouloud Touil,
	Stephen Rothwell, LKML, kbuild test robot

pt., 10 sty 2020 o 11:16 Srinivas Kandagatla
<srinivas.kandagatla@linaro.org> napisał(a):
>
> Thanks for the patch.
>
> On 10/01/2020 08:24, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > 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 <lkp@intel.com>
> > Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
> > Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > ---
>
> Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>

Thanks. This is rather uncontroversial, so applied right away.

Bart

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-10 11:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10  8:24 [PATCH -next] nvmem: fix a 'makes pointer from integer without a cast' build warning Bartosz Golaszewski
2020-01-10  8:26 ` Bartosz Golaszewski
2020-01-10 10:16 ` Srinivas Kandagatla
2020-01-10 11:13   ` Bartosz Golaszewski

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).