nvmem: fix a 'makes pointer from integer without a cast' build warning
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Fri, 10 Jan 2020 08:19:29 +0000 (09:19 +0100)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Fri, 10 Jan 2020 11:11:30 +0000 (12:11 +0100)
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

index 3e1c94c..408ce70 100644 (file)
@@ -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);