Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a195c6d authored by Thor Thayer's avatar Thor Thayer Committed by Linus Walleij
Browse files

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: default avatarThor Thayer <tthayer@opensource.altera.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent f85522c2
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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)