diff mbox series

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

Message ID 20191205160655.32188-1-hslester96@gmail.com (mailing list archive)
State Mainlined
Commit cf33e911f500f6e628f283e101c0240c79e0b5da
Headers show
Series rtc: stm32: add missed clk_disable_unprepare in error path of resume | expand

Commit Message

Chuhong Yuan Dec. 5, 2019, 4:06 p.m. UTC
The resume() forgets to call clk_disable_unprepare() when failed.
Add the missed call to fix it.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/rtc/rtc-stm32.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Amelie Delaunay Dec. 6, 2019, 8:19 a.m. UTC | #1
On 12/5/19 5:06 PM, Chuhong Yuan wrote:
> The resume() forgets to call clk_disable_unprepare() when failed.
> Add the missed call to fix it.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---
>   drivers/rtc/rtc-stm32.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
> index 781cabb2afca..d774aa18f57a 100644
> --- a/drivers/rtc/rtc-stm32.c
> +++ b/drivers/rtc/rtc-stm32.c
> @@ -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);
> 

Reviewed-by: Amelie Delaunay <amelie.delaunay@st.com>
Alexandre Belloni Dec. 10, 2019, 1:29 p.m. UTC | #2
On 06/12/2019 00:06:55+0800, Chuhong Yuan wrote:
> The resume() forgets to call clk_disable_unprepare() when failed.
> Add the missed call to fix it.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---
>  drivers/rtc/rtc-stm32.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index 781cabb2afca..d774aa18f57a 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -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);