[PATCH] rtc: lpc24xx: fix clock disable order in remove

Jiawen Liu 1298662399 at qq.com
Tue Aug 18 05:41:21 PDT 2026


From: jiawen <1298662399 at qq.com>

lpc24xx_rtc_probe enables clk_rtc before clk_reg, and its error path
disables clk_reg before clk_rtc. However, lpc24xx_rtc_remove disables
clk_rtc before clk_reg, which is the opposite order. This can leave a
clock prepared if probe fails after enabling both clocks, since remove
is not called on the error path.

Fix the remove function to disable clk_reg before clk_rtc, matching the
enable order and the error path cleanup order.

Signed-off-by: jiawen <1298662399 at qq.com>
---
diff --git a/drivers/rtc/rtc-lpc24xx.c b/drivers/rtc/rtc-lpc24xx.c
--- a/drivers/rtc/rtc-lpc24xx.c
+++ b/drivers/rtc/rtc-lpc24xx.c
@@ -272,8 +272,8 @@
 
 	rtc_writel(rtc, LPC24XX_CCR, LPC178X_CCALEN);
 
+	clk_disable_unprepare(rtc->clk_reg);
 	clk_disable_unprepare(rtc->clk_rtc);
-	clk_disable_unprepare(rtc->clk_reg);
 }
 
 static const struct of_device_id lpc24xx_rtc_match[] = {




More information about the linux-arm-kernel mailing list