diff mbox series

watchdog: starfive: Add missing clk_disable_unprepare()

Message ID 20240628033508.281058-1-nichen@iscas.ac.cn
State New
Headers show
Series watchdog: starfive: Add missing clk_disable_unprepare() | expand

Commit Message

Chen Ni June 28, 2024, 3:35 a.m. UTC
Add the missing clk_disable_unprepare() before return in
starfive_wdt_enable_clock().

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/watchdog/starfive-wdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Xingyu Wu June 28, 2024, 8:50 a.m. UTC | #1
On 28/06/2024 11:35, Chen Ni wrote:

> 
> Add the missing clk_disable_unprepare() before return in
> starfive_wdt_enable_clock().
> 
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
>  drivers/watchdog/starfive-wdt.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
> index b4b059883618..19a2620d3d38 100644
> --- a/drivers/watchdog/starfive-wdt.c
> +++ b/drivers/watchdog/starfive-wdt.c
> @@ -152,8 +152,10 @@ static int starfive_wdt_enable_clock(struct starfive_wdt
> *wdt)
>  		return dev_err_probe(wdt->wdd.parent, ret, "failed to enable
> apb clock\n");
> 
>  	ret = clk_prepare_enable(wdt->core_clk);
> -	if (ret)
> +	if (ret) {
> +		clk_disable_unprepare(wdt->apb_clk);
>  		return dev_err_probe(wdt->wdd.parent, ret, "failed to enable
> core clock\n");
> +	}
> 
>  	return 0;
>  }

It looks good. Thanks for your patch.

Reviewed-by: Xingyu Wu <xingyu.wu@starfivetech.com>

Best regards,
Xingyu Wu
Guenter Roeck June 28, 2024, 4:48 p.m. UTC | #2
On 6/27/24 20:35, Chen Ni wrote:
> Add the missing clk_disable_unprepare() before return in
> starfive_wdt_enable_clock().
> 
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/watchdog/starfive-wdt.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
> index b4b059883618..19a2620d3d38 100644
> --- a/drivers/watchdog/starfive-wdt.c
> +++ b/drivers/watchdog/starfive-wdt.c
> @@ -152,8 +152,10 @@ static int starfive_wdt_enable_clock(struct starfive_wdt *wdt)
>   		return dev_err_probe(wdt->wdd.parent, ret, "failed to enable apb clock\n");
>   
>   	ret = clk_prepare_enable(wdt->core_clk);
> -	if (ret)
> +	if (ret) {
> +		clk_disable_unprepare(wdt->apb_clk);
>   		return dev_err_probe(wdt->wdd.parent, ret, "failed to enable core clock\n");
> +	}
>   
>   	return 0;
>   }
diff mbox series

Patch

diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
index b4b059883618..19a2620d3d38 100644
--- a/drivers/watchdog/starfive-wdt.c
+++ b/drivers/watchdog/starfive-wdt.c
@@ -152,8 +152,10 @@  static int starfive_wdt_enable_clock(struct starfive_wdt *wdt)
 		return dev_err_probe(wdt->wdd.parent, ret, "failed to enable apb clock\n");
 
 	ret = clk_prepare_enable(wdt->core_clk);
-	if (ret)
+	if (ret) {
+		clk_disable_unprepare(wdt->apb_clk);
 		return dev_err_probe(wdt->wdd.parent, ret, "failed to enable core clock\n");
+	}
 
 	return 0;
 }