mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rtc: rtc-cadence: fix clock cleanup ordering
@ 2026-08-18 12:41 Jiawen Liu
  2026-08-18 20:24 ` Christophe JAILLET
  0 siblings, 1 reply; 3+ messages in thread
From: Jiawen Liu @ 2026-08-18 12:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: jiawen

From: jiawen <1298662399@qq.com>

The probe function enables the peripheral clock (pclk) before the
reference clock (ref_clk), and its error path disables ref_clk before
pclk. However, the remove function disables pclk before ref_clk, which
is the reverse order. This asymmetric teardown can leave the clock
framework in an inconsistent state and violates the expected lifecycle
balance. Fix the remove function to disable ref_clk first, then pclk,
matching the probe enable order and the error path cleanup order.

Signed-off-by: jiawen <1298662399@qq.com>
---
diff --git a/drivers/rtc/rtc-cadence.c b/drivers/rtc/rtc-cadence.c
--- a/drivers/rtc/rtc-cadence.c
+++ b/drivers/rtc/rtc-cadence.c
@@ -361,8 +361,8 @@
 	cdns_rtc_alarm_irq_enable(&pdev->dev, 0);
 	device_init_wakeup(&pdev->dev, false);
 
+	clk_disable_unprepare(crtc->ref_clk);
 	clk_disable_unprepare(crtc->pclk);
-	clk_disable_unprepare(crtc->ref_clk);
 }
 
 #ifdef CONFIG_PM_SLEEP


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

end of thread, other threads:[~2026-11-08 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-18 12:41 [PATCH] rtc: rtc-cadence: fix clock cleanup ordering Jiawen Liu
2026-08-18 20:24 ` Christophe JAILLET
2026-11-08 17:22   ` Jiawen Liu

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

all inboxes | Powered by JetHome®