gpiolib: check for parent device in devprop_gpiochip_set_names()
It's possible for a GPIO chip to not have a parent device (whose
properties we inspect for 'gpio-line-names'). In this case we should
simply return from devprop_gpiochip_set_names(). Add an appropriate
check for this use-case.
Fixes: 7cba1a4d5e
("gpiolib: generalize devprop_gpiochip_set_names() for device properties")
Reported-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
32fc5aa2df
commit
587823d39f
@ -375,6 +375,10 @@ static int devprop_gpiochip_set_names(struct gpio_chip *chip)
|
||||
int ret, i;
|
||||
int count;
|
||||
|
||||
/* GPIO chip may not have a parent device whose properties we inspect. */
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
||||
count = device_property_string_array_count(dev, "gpio-line-names");
|
||||
if (count < 0)
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user