[PATCH] soc: rockchip: grf: Fix device node reference leak in rockchip_grf_init()

Felix Gu posted 1 patch 2 weeks, 2 days ago
drivers/soc/rockchip/grf.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] soc: rockchip: grf: Fix device node reference leak in rockchip_grf_init()
Posted by Felix Gu 2 weeks, 2 days ago
In rockchip_grf_init(), when syscon_node_to_regmap fails, it returns
without calling of_node_put(), which causes a reference leak.

Add the missing of_node_put() call to fix it.

Fixes: 75fb63ae0312 ("soc: rockchip: grf: Support multiple grf to be handled")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/soc/rockchip/grf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/rockchip/grf.c b/drivers/soc/rockchip/grf.c
index 04937c40da47..b459607c118a 100644
--- a/drivers/soc/rockchip/grf.c
+++ b/drivers/soc/rockchip/grf.c
@@ -231,6 +231,7 @@ static int __init rockchip_grf_init(void)
 		grf = syscon_node_to_regmap(np);
 		if (IS_ERR(grf)) {
 			pr_err("%s: could not get grf syscon\n", __func__);
+			of_node_put(np);
 			return PTR_ERR(grf);
 		}
 

---
base-commit: 350adaf7fde9fdbd9aeed6d442a9ae90c6a3ab97
change-id: 20260217-grf-fc76046fe5e3

Best regards,
-- 
Felix Gu <ustc.gu@gmail.com>
Re: [PATCH] soc: rockchip: grf: Fix device node reference leak in rockchip_grf_init()
Posted by Heiko Stübner 1 week, 4 days ago
Hi Felix,

Am Montag, 16. Februar 2026, 21:11:32 Mitteleuropäische Normalzeit schrieb Felix Gu:
> In rockchip_grf_init(), when syscon_node_to_regmap fails, it returns
> without calling of_node_put(), which causes a reference leak.
> 
> Add the missing of_node_put() call to fix it.
> 
> Fixes: 75fb63ae0312 ("soc: rockchip: grf: Support multiple grf to be handled")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>

Shawn was a bit earlier with a similar fix [0], so their patch will go in.

Heiko



[0] https://lore.kernel.org/all/1770814957-17762-1-git-send-email-shawn.lin@rock-chips.com/