summaryrefslogtreecommitdiff
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2024-05-04 16:20:16 +0300
committerLinus Walleij <linus.walleij@linaro.org>2024-06-26 12:59:31 +0300
commit7f500f2011c0bbb6e1cacab74b4c99222e60248e (patch)
tree6124765f79429f30d9e0efc83bf7aaaec65dc3fe /drivers/pinctrl
parentd7f5120a944a5b515d6307c8cbfcd4f1fde543fb (diff)
downloadlinux-7f500f2011c0bbb6e1cacab74b4c99222e60248e.tar.xz
pinctrl: freescale: mxs: Fix refcount of child
of_get_next_child() will increase refcount of the returned node, need use of_node_put() on it when done. Per current implementation, 'child' will be override by for_each_child_of_node(np, child), so use of_get_child_count to avoid refcount leakage. Fixes: 17723111e64f ("pinctrl: add pinctrl-mxs support") Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/20240504-pinctrl-cleanup-v2-18-26c5f2dc1181@nxp.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/freescale/pinctrl-mxs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c
index e77311f26262..4813a9e16cb3 100644
--- a/drivers/pinctrl/freescale/pinctrl-mxs.c
+++ b/drivers/pinctrl/freescale/pinctrl-mxs.c
@@ -413,8 +413,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
int ret;
u32 val;
- child = of_get_next_child(np, NULL);
- if (!child) {
+ val = of_get_child_count(np);
+ if (val == 0) {
dev_err(&pdev->dev, "no group is defined\n");
return -ENOENT;
}