]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
gpio: of: Fix NPE from OF flags
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 16 Jan 2018 22:44:46 +0000 (23:44 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 17 Jan 2018 06:44:16 +0000 (07:44 +0100)
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

index 71ba008b7f46a0d65b156756c4992eeffc133e10..27e8a339310c9035fc71f833aafb824cef051874 100644 (file)
@@ -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,