[PATCH] pinctrl/rockchip: Fix refcount leak bug

Liang He windhl at 126.com
Sun Jun 19 00:33:15 PDT 2022


In rockchip_pinctrl_parse_groups(), we need a of_node_put() in each
loop for the of_find_node_by_phandle() to keep the refcount balance.

Signed-off-by: Liang He <windhl at 126.com>
---
 drivers/pinctrl/pinctrl-rockchip.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 32e41395fc76..d78827c97760 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -2710,6 +2710,7 @@ static int rockchip_pinctrl_parse_groups(struct device_node *np,
 		np_config = of_find_node_by_phandle(be32_to_cpup(phandle));
 		ret = pinconf_generic_parse_dt_config(np_config, NULL,
 				&grp->data[j].configs, &grp->data[j].nconfigs);
+		of_node_put(np_config);
 		if (ret)
 			return ret;
 	}
-- 
2.25.1




More information about the Linux-rockchip mailing list