diff mbox series

pinctrl/rockchip: Fix refcount leak bug

Message ID 20220619073315.4067956-1-windhl@126.com
State New
Headers show
Series pinctrl/rockchip: Fix refcount leak bug | expand

Commit Message

Liang He June 19, 2022, 7:33 a.m. UTC
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@126.com>
---
 drivers/pinctrl/pinctrl-rockchip.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Krzysztof Kozlowski June 22, 2022, 8:58 a.m. UTC | #1
On 19/06/2022 09:33, Liang He wrote:
> 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@126.com>
> ---
>  drivers/pinctrl/pinctrl-rockchip.c | 1 +
>  1 file changed, 1 insertion(+)

Before applying the patch please check it carefully. Previous evidence
[1][2] suggests that not it was not even compiled.



[1] https://lore.kernel.org/all/202206221602.odN70SHs-lkp@intel.com/

[2]
https://lore.kernel.org/all/16f9a971.44e5.1817068ee3c.Coremail.windhl@126.com/


Best regards,
Krzysztof
diff mbox series

Patch

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;
 	}