提交 5a195c6d 编写于 作者: T Thor Thayer 提交者: Linus Walleij

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: NThor Thayer <tthayer@opensource.altera.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 f85522c2
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册