Skip to contentSkip to conversation

rtc: stm32: add missed clk_disable_unprepare in error path of resume

PATCH Applied Chuhong Yuan 3 participants 3 messages Dec 5, 2019 – Dec 10, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: stm32: add missed clk_disable_unprepare in error path of resume

The resume() forgets to call clk_disable_unprepare() when failed. Add the missed call to fix it.

---
 drivers/rtc/rtc-stm32.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/rtc/rtc-stm32.c +4 -1
index 781cabb2afca..d774aa18f57a 100644
@@ -897,8 +897,11 @@ static int stm32_rtc_resume(struct device *dev)
 	}
 
 	ret = stm32_rtc_wait_sync(rtc);
-	if (ret < 0)
+	if (ret < 0) {
+		if (rtc->data->has_pclk)
+			clk_disable_unprepare(rtc->pclk);
 		return ret;
+	}
 
 	if (device_may_wakeup(dev))
 		return disable_irq_wake(rtc->irq_alarm);
Signature · 1 line
2.24.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Chuhong Yuan

The resume() forgets to call clk_disable_unprepare() when failed. Add the missed call to fix it.

---
  drivers/rtc/rtc-stm32.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/rtc/rtc-stm32.c +0 -0
index 781cabb2afca..d774aa18f57a 100644
@@ -897,8 +897,11 @@ static int stm32_rtc_resume(struct device *dev)
  	}
 

drivers/rtc/rtc-stm32.c static int stm32_rtc_resume(struct device *dev) · line 907

Quoted 10 lines
drivers/rtc/rtc-stm32.c +4 -1
  	ret = stm32_rtc_wait_sync(rtc);
-	if (ret < 0)
+	if (ret < 0) {
+		if (rtc->data->has_pclk)
+			clk_disable_unprepare(rtc->pclk);
  		return ret;
+	}
 
  	if (device_may_wakeup(dev))
  		return disable_irq_wake(rtc->irq_alarm);

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer Applied
#2 lore raw
In reply to Chuhong Yuan
Quoted 8 lines · Chuhong Yuan

The resume() forgets to call clk_disable_unprepare() when failed. Add the missed call to fix it.

---
 drivers/rtc/rtc-stm32.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com