Commit 7f500f20 authored by Peng Fan's avatar Peng Fan Committed by Linus Walleij
Browse files

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: 17723111 ("pinctrl: add pinctrl-mxs support")
Signed-off-by: default avatarPeng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/20240504-pinctrl-cleanup-v2-18-26c5f2dc1181@nxp.com


Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent d7f5120a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
	}