From: jiawen <redacted>
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 <redacted>
---
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[] = {