* [PATCH] pinctrl: pinconf-generic: add missing of_node_put() in pinconf_generic_dt_node_to_map()
@ 2022-11-25 7:01 Peng Zhang
2022-11-25 9:49 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Peng Zhang @ 2022-11-25 7:01 UTC (permalink / raw)
To: linus.walleij, baruch, ldewangan
Cc: linux-gpio, linux-kernel, sunnanyong, wangkefeng.wang, ZhangPeng
From: ZhangPeng <zhangpeng362@huawei.com>
of_node_put() needs to be called when jumping out of the loop, since
for_each_available_child_of_node() will increase the refcount of node.
Fixes: c7289500e29d ("pinctrl: pinconf-generic: scan also referenced phandle node")
Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
---
drivers/pinctrl/pinconf-generic.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
index 415d1df8f46a..365c4b0ca465 100644
--- a/drivers/pinctrl/pinconf-generic.c
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -395,8 +395,10 @@ int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev,
for_each_available_child_of_node(np_config, np) {
ret = pinconf_generic_dt_subnode_to_map(pctldev, np, map,
&reserved_maps, num_maps, type);
- if (ret < 0)
+ if (ret < 0) {
+ of_node_put(np);
goto exit;
+ }
}
return 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] pinctrl: pinconf-generic: add missing of_node_put() in pinconf_generic_dt_node_to_map()
2022-11-25 7:01 [PATCH] pinctrl: pinconf-generic: add missing of_node_put() in pinconf_generic_dt_node_to_map() Peng Zhang
@ 2022-11-25 9:49 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2022-11-25 9:49 UTC (permalink / raw)
To: Peng Zhang
Cc: baruch, ldewangan, linux-gpio, linux-kernel, sunnanyong, wangkefeng.wang
On Fri, Nov 25, 2022 at 8:02 AM Peng Zhang <zhangpeng362@huawei.com> wrote:
> From: ZhangPeng <zhangpeng362@huawei.com>
>
> of_node_put() needs to be called when jumping out of the loop, since
> for_each_available_child_of_node() will increase the refcount of node.
>
> Fixes: c7289500e29d ("pinctrl: pinconf-generic: scan also referenced phandle node")
> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
Good catch!
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-25 9:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 7:01 [PATCH] pinctrl: pinconf-generic: add missing of_node_put() in pinconf_generic_dt_node_to_map() Peng Zhang
2022-11-25 9:49 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.