pinctrl: madera: Fix possible NULL pointer with pdata config
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Tue, 28 Aug 2018 08:45:37 +0000 (09:45 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 29 Aug 2018 12:02:47 +0000 (14:02 +0200)
If we are being configured via pdata we don't necessarily have
any gpio mappings being configured that way so pdata->gpio_config
could be NULL.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/cirrus/pinctrl-madera-core.c

index ece41fb..c4f4d90 100644 (file)
@@ -1040,7 +1040,7 @@ static int madera_pin_probe(struct platform_device *pdev)
        }
 
        /* if the configuration is provided through pdata, apply it */
-       if (pdata) {
+       if (pdata && pdata->gpio_configs) {
                ret = pinctrl_register_mappings(pdata->gpio_configs,
                                                pdata->n_gpio_configs);
                if (ret) {