nvmem: fix a 'makes pointer from integer without a cast' build warning

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: 2a127da461 ("nvmem: add support for the write-protect pin")
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
This commit is contained in:
Bartosz Golaszewski 2020-01-10 09:19:29 +01:00
parent 1c89074bf8
commit a99d2c6ccd

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