* [PATCH] pinctrl: just return if no valid maps
@ 2019-11-01 11:43 lijiazi
2019-11-05 10:26 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: lijiazi @ 2019-11-01 11:43 UTC (permalink / raw)
To: Linus Walleij; +Cc: lijiazi, linux-gpio
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>
---
drivers/pinctrl/devicetree.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
index 5d6d8b1..dedf450 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -147,6 +147,14 @@ 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 no valid maps, maybe caused by empty pinctrl node
+ * or typing error, no need remember, 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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] pinctrl: just return if no valid maps
2019-11-01 11:43 [PATCH] pinctrl: just return if no valid maps lijiazi
@ 2019-11-05 10:26 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2019-11-05 10:26 UTC (permalink / raw)
To: lijiazi; +Cc: lijiazi, open list:GPIO SUBSYSTEM
On Fri, Nov 1, 2019 at 12:44 PM lijiazi <jqqlijiazi@gmail.com> wrote:
> 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>
Good find. Patch applied! (I tweaked the text a bit.)
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-05 10:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-01 11:43 [PATCH] pinctrl: just return if no valid maps lijiazi
2019-11-05 10:26 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).