linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: of: Fix NPE from OF flags
@ 2018-01-16 22:48 Linus Walleij
  0 siblings, 0 replies; only message in thread
From: Linus Walleij @ 2018-01-16 22:48 UTC (permalink / raw)
  To: linux-gpio, Clemens Gruber, Lukas Wunner; +Cc: Linus Walleij, Heiner Kallweit

Some calls to of_get_named_gpio() calls sets the flags
argument to NULL because they are not interested in the
flags. This caused a null pointer exception since we were
unconditionally using these flags. Fix it.

Fixes: 6a537d48461d ("gpio: of: Support regulator nonstandard GPIO properties")
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpiolib-of.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 71ba008b7f46..27e8a339310c 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -129,7 +129,8 @@ struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
 	if (IS_ERR(desc))
 		goto out;
 
-	of_gpio_flags_quirks(np, flags);
+	if (flags)
+		of_gpio_flags_quirks(np, flags);
 
 	pr_debug("%s: parsed '%s' property of node '%pOF[%d]' - status (%d)\n",
 		 __func__, propname, np, index,
-- 
2.14.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-16 22:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-16 22:48 [PATCH] gpio: of: Fix NPE from OF flags Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).