pinctrl: handle zero found dt pinconfig properties better
authorHeiko Stübner <heiko@sntech.de>
Fri, 14 Jun 2013 15:43:21 +0000 (17:43 +0200)
committerMark Brown <broonie@linaro.org>
Fri, 4 Apr 2014 15:20:40 +0000 (16:20 +0100)
This adds a shortcut when no valid pinconf properties are found
in the parsed dt node, to set the values immediately and return.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit e4a8844c04c00a1a64c6779692e1baff3851c1f7)
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/pinctrl/pinconf-generic.c

index dcf03714de90552883cbcdaf2534200d46c0f3ba..ea9da175225290d91f9efb4215bc2311bfad737d 100644 (file)
@@ -208,6 +208,13 @@ int pinconf_generic_parse_dt_config(struct device_node *np,
                ncfg++;
        }
 
+       /* no configs found at all */
+       if (ncfg == 0) {
+               *configs = NULL;
+               *nconfigs = 0;
+               return 0;
+       }
+
        /*
         * Now limit the number of configs to the real number of
         * found properties.