]> git.baikalelectronics.ru Git - kernel.git/commitdiff
pinctrl: pinconf-generic: add missing of_node_put()
authorZhangPeng <zhangpeng362@huawei.com>
Fri, 25 Nov 2022 07:01:56 +0000 (07:01 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:06 +0000 (11:41 +0100)
[ Upstream commit 5ead93289815a075d43c415e35c8beafafb801c9 ]

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: 9b8a05972fe3 ("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>
drivers/pinctrl/pinconf-generic.c

index 355bc4c748e2685abaf4cd0026aaab1e71106852..02c015577cf95667b22e13c9ffeeceeaecd44259 100644 (file)
@@ -391,8 +391,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;