aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorlijiazi <jqqlijiazi@gmail.com>2019-11-01 19:43:52 +0800
committerLinus Walleij <linus.walleij@linaro.org>2019-11-05 11:25:39 +0100
commit6e4f3db8dfcf6c4126232086251a31db364503e1 (patch)
tree74e0329be95309144b857521257d54b9b0e785cb /drivers
parentdt-bindings: pinctrl: qcom-pmic-mpp: Add support for PM/PMI8950 (diff)
downloadlinux-dev-6e4f3db8dfcf6c4126232086251a31db364503e1.tar.xz
linux-dev-6e4f3db8dfcf6c4126232086251a31db364503e1.zip
pinctrl: just return if no valid maps
If there is a problem with a pinctrl node of a device, for example, config child node do not have prop specified in dt_params, num_maps maybe 0. On this condition, no need remember this map. Signed-off-by: lijiazi <lijiazi@xiaomi.com> Link: https://lore.kernel.org/r/29421e7720443a2454830963186f00583c76ce1e.1572588550.git.lijiazi@xiaomi.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pinctrl/devicetree.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
index 1a300374a16d..674920daac26 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -162,6 +162,16 @@ static int dt_to_map_one_config(struct pinctrl *p,
ret = ops->dt_node_to_map(pctldev, np_config, &map, &num_maps);
if (ret < 0)
return ret;
+ else if (num_maps == 0) {
+ /*
+ * If we have no valid maps (maybe caused by empty pinctrl node
+ * or typing error) ther is no need remember this, so just
+ * return.
+ */
+ dev_info(p->dev,
+ "there is not valid maps for state %s\n", statename);
+ return 0;
+ }
/* Stash the mapping table chunk away for later use */
return dt_remember_or_free_map(p, statename, pctldev, map, num_maps);