Skip to content

Commit

Permalink
pinctrl: pinconf-generic: add missing of_node_put()
Browse files Browse the repository at this point in the history
[ Upstream commit 5ead932 ]

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: c728950 ("pinctrl: pinconf-generic: scan also referenced phandle node")
Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
Link: https://lore.kernel.org/r/20221125070156.3535855-1-zhangpeng362@huawei.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
ZhangPeng authored and gregkh committed Dec 31, 2022
1 parent eedc698 commit 825a8af
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/pinctrl/pinconf-generic.c
Expand Up @@ -393,8 +393,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;

Expand Down

0 comments on commit 825a8af

Please sign in to comment.