diff mbox series

rtc: st-lpc: Add missing clk_disable_unprepare in st_rtc_probe()

Message ID 20221122121907.1648044-1-cuigaosheng1@huawei.com
State Superseded
Headers show
Series rtc: st-lpc: Add missing clk_disable_unprepare in st_rtc_probe() | expand

Commit Message

cuigaosheng Nov. 22, 2022, 12:19 p.m. UTC
The clk_get_rate() should be called in the error handling of
clk_get_rate(), fix it.

Fixes: b5b2bdfc2893 ("rtc: st: Add new driver for ST's LPC RTC")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/rtc/rtc-st-lpc.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Alexandre Belloni Nov. 22, 2022, 1:45 p.m. UTC | #1
On 22/11/2022 20:19:07+0800, Gaosheng Cui wrote:
> The clk_get_rate() should be called in the error handling of
> clk_get_rate(), fix it.
> 

This is not what the patch does

> Fixes: b5b2bdfc2893 ("rtc: st: Add new driver for ST's LPC RTC")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
>  drivers/rtc/rtc-st-lpc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/rtc/rtc-st-lpc.c b/drivers/rtc/rtc-st-lpc.c
> index bdb20f63254e..0f8e4231098e 100644
> --- a/drivers/rtc/rtc-st-lpc.c
> +++ b/drivers/rtc/rtc-st-lpc.c
> @@ -238,6 +238,7 @@ static int st_rtc_probe(struct platform_device *pdev)
>  
>  	rtc->clkrate = clk_get_rate(rtc->clk);
>  	if (!rtc->clkrate) {
> +		clk_disable_unprepare(rtc->clk);
>  		dev_err(&pdev->dev, "Unable to fetch clock rate\n");
>  		return -EINVAL;
>  	}
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-st-lpc.c b/drivers/rtc/rtc-st-lpc.c
index bdb20f63254e..0f8e4231098e 100644
--- a/drivers/rtc/rtc-st-lpc.c
+++ b/drivers/rtc/rtc-st-lpc.c
@@ -238,6 +238,7 @@  static int st_rtc_probe(struct platform_device *pdev)
 
 	rtc->clkrate = clk_get_rate(rtc->clk);
 	if (!rtc->clkrate) {
+		clk_disable_unprepare(rtc->clk);
 		dev_err(&pdev->dev, "Unable to fetch clock rate\n");
 		return -EINVAL;
 	}