public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] soc: rockchip: grf: fix device node refcount leak in error path
@ 2026-02-21  0:40 xiaopeitux
  2026-02-21 14:51 ` Heiko Stübner
  0 siblings, 1 reply; 3+ messages in thread
From: xiaopeitux @ 2026-02-21  0:40 UTC (permalink / raw)
  To: heiko, shawn.lin, linux-arm-kernel, linux-rockchip, linux-kernel; +Cc: Pei Xiao

From: Pei Xiao <xiaopei01@kylinos.cn>

The for_each_matching_node_and_match() macro automatically manages device
node reference counts during normal iteration. However, when breaking out
of the loop early with return, the current iteration's node is not
automatically released, leading to a reference count leak.

Fix this by adding of_node_put() before returning from the loop
when fails.

Fixes: 75fb63ae0312 ("soc: rockchip: grf: Support multiple grf to be handled")
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
 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);
 		}
 
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-21 15:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-21  0:40 [PATCH] soc: rockchip: grf: fix device node refcount leak in error path xiaopeitux
2026-02-21 14:51 ` Heiko Stübner
2026-02-21 15:26   ` Heiko Stübner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox