aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorThor Thayer <tthayer@opensource.altera.com>2016-10-25 12:31:23 -0400
committerLinus Walleij <linus.walleij@linaro.org>2016-10-25 14:23:19 -0400
commit5a195c6d4ecf43be26ee1c8be6140025832adfd2 (patch)
tree361a8a073c8d3143c3c291053c045b4b80b4fea4 /drivers/gpio
parentf85522c207ce395fc9c1f6b80a47f211d00914b0 (diff)
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>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib-devprop.c5
1 files changed, 5 insertions, 0 deletions
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)
31 const char **names; 31 const char **names;
32 int ret, i; 32 int ret, i;
33 33
34 if (!chip->parent) {
35 dev_warn(&gdev->dev, "GPIO chip parent is NULL\n");
36 return;
37 }
38
34 ret = device_property_read_string_array(chip->parent, "gpio-line-names", 39 ret = device_property_read_string_array(chip->parent, "gpio-line-names",
35 NULL, 0); 40 NULL, 0);
36 if (ret < 0) 41 if (ret < 0)