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)
committer黄涛 <huangtao@rock-chips.com>
Sat, 30 Nov 2013 04:04:27 +0000 (12:04 +0800)
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>
drivers/pinctrl/pinconf-generic.c

index 807ffb4c361eb22f5ce3b64dede6a3e9a9d94cb5..f6e6ea1b7643db572ed1d7d7cd4661f27d6d9cff 100644 (file)
@@ -204,6 +204,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.