From: Thor Thayer Date: Tue, 25 Oct 2016 16:31:23 +0000 (-0500) Subject: gpio: gpiolib-devprop: Check chip->parent pointer before dereferencing X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5a195c6d4ecf43be26ee1c8be6140025832adfd2;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpiolib-devprop.c b/drivers/gpio/gpiolib-devprop.c index 17bfc41692ef..27f383bda7d9 100644 --- a/drivers/gpio/gpiolib-devprop.c +++ b/drivers/gpio/gpiolib-devprop.c @@ -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)