public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] devfreq: event: rockchip-dfi: fix missing clk_disable_unprepare() on error
@ 2026-03-19 16:30 Anas Iqbal
  2026-04-29 22:35 ` Choi Chanwoo
  0 siblings, 1 reply; 2+ messages in thread
From: Anas Iqbal @ 2026-03-19 16:30 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Heiko Stuebner
  Cc: Kyungmin Park, Sascha Hauer, Sebastian Reichel, Jonathan Cameron,
	linux-pm, linux-arm-kernel, linux-rockchip, linux-kernel,
	Anas Iqbal

Smatch reports:
drivers/devfreq/event/rockchip-dfi.c:215 rockchip_dfi_enable() warn:
'dfi->clk' from clk_prepare_enable() not released.

If rockchip_dfi_ddrtype_to_ctrl() fails after clk_prepare_enable(),
the clock is not disabled, leading to a resource leak.

Add clk_disable_unprepare() in the error path to properly release
the clock.

Fixes: d724f4a4581b ("PM / devfreq: rockchip-dfi: Prepare for multiple users")
Signed-off-by: Anas Iqbal <mohd.abd.6602@gmail.com>
---
 drivers/devfreq/event/rockchip-dfi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c
index 5e6e7e900bda..8db0bceeded4 100644
--- a/drivers/devfreq/event/rockchip-dfi.c
+++ b/drivers/devfreq/event/rockchip-dfi.c
@@ -185,8 +185,10 @@ static int rockchip_dfi_enable(struct rockchip_dfi *dfi)
 	}
 
 	ret = rockchip_dfi_ddrtype_to_ctrl(dfi, &ctrl);
-	if (ret)
+	if (ret) {
+		clk_disable_unprepare(dfi->clk);
 		goto out;
+	}
 
 	for (i = 0; i < dfi->max_channels; i++) {
 
-- 
2.43.0


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

end of thread, other threads:[~2026-04-29 22:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 16:30 [PATCH] devfreq: event: rockchip-dfi: fix missing clk_disable_unprepare() on error Anas Iqbal
2026-04-29 22:35 ` Choi Chanwoo

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