Skip to content

Commit 7f500f2

Browse files
MrVanlinusw
authored andcommitted
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: 1772311 ("pinctrl: add pinctrl-mxs support") Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent d7f5120 commit 7f500f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/pinctrl/freescale/pinctrl-mxs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
413413
int ret;
414414
u32 val;
415415

416-
child = of_get_next_child(np, NULL);
417-
if (!child) {
416+
val = of_get_child_count(np);
417+
if (val == 0) {
418418
dev_err(&pdev->dev, "no group is defined\n");
419419
return -ENOENT;
420420
}

0 commit comments

Comments
 (0)