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

Jiawen Liu <[email protected]>
Newsgroups org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: jiawen <[email protected]>

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 <[email protected]>
---
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[] = {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.