Skip to contentSkip to conversation

soc: rockchip: Fix refcount leak in rockchip_grf_init

PATCH Applied Miaoqian Lin 2 participants 2 messages May 16, 2022 – May 17, 2022 Arm Rockchip

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: rockchip: Fix refcount leak in rockchip_grf_init

of_find_matching_node_and_match returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.

Fixes 4c58063d4258 ("soc: rockchip: add driver handling grf setup")
---
 drivers/soc/rockchip/grf.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/soc/rockchip/grf.c +2 -0
index 494cf2b5bf7b..343ff61ccccb 100644
@@ -148,12 +148,14 @@ static int __init rockchip_grf_init(void)
 		return -ENODEV;
 	if (!match || !match->data) {
 		pr_err("%s: missing grf data\n", __func__);
+		of_node_put(np);
 		return -EINVAL;
 	}
 
 	grf_info = match->data;
 
 	grf = syscon_node_to_regmap(np);
+	of_node_put(np);
 	if (IS_ERR(grf)) {
 		pr_err("%s: could not get grf syscon\n", __func__);
 		return PTR_ERR(grf);
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 3 lines · Miaoqian Lin

of_find_matching_node_and_match returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak.

Applied, thanks!

[1/1] soc: rockchip: Fix refcount leak in rockchip_grf_init

      commit: 9b59588d8be91c96bfb0371e912ceb4f16315dbf

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>