mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
gpio: gpiolib-devprop: Check chip->parent pointer before dereferencing
Confirm the chip->parent is valid before dereferencing because the parent parameter is optional. Signed-off-by: Thor Thayer <tthayer@opensource.altera.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
f85522c207
commit
5a195c6d4e
1 changed files with 5 additions and 0 deletions
|
@ -31,6 +31,11 @@ void devprop_gpiochip_set_names(struct gpio_chip *chip)
|
|||
const char **names;
|
||||
int ret, i;
|
||||
|
||||
if (!chip->parent) {
|
||||
dev_warn(&gdev->dev, "GPIO chip parent is NULL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = device_property_read_string_array(chip->parent, "gpio-line-names",
|
||||
NULL, 0);
|
||||
if (ret < 0)
|
||||
|
|
Loading…
Reference in a new issue