diff mbox series

[-next,2/2] clocksource/drivers/cadence-ttc: Add missing clk_disable_unprepare in ttc_setup_clockevent

Message ID 20240803064253.331946-3-cuigaosheng1@huawei.com (mailing list archive)
State New, archived
Headers show
Series Add missing clk_disable_unprepare | expand

Commit Message

cuigaosheng Aug. 3, 2024, 6:42 a.m. UTC
Add the missing clk_disable_unprepare() before return in
ttc_setup_clockevent().

Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/clocksource/timer-cadence-ttc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Michal Simek Aug. 5, 2024, 10:16 a.m. UTC | #1
On 8/3/24 08:42, Gaosheng Cui wrote:
> Add the missing clk_disable_unprepare() before return in
> ttc_setup_clockevent().
> 
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
>   drivers/clocksource/timer-cadence-ttc.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clocksource/timer-cadence-ttc.c b/drivers/clocksource/timer-cadence-ttc.c
> index ca7a06489c40..b8a1cf59b9d6 100644
> --- a/drivers/clocksource/timer-cadence-ttc.c
> +++ b/drivers/clocksource/timer-cadence-ttc.c
> @@ -435,7 +435,7 @@ static int __init ttc_setup_clockevent(struct clk *clk,
>   				    &ttcce->ttc.clk_rate_change_nb);
>   	if (err) {
>   		pr_warn("Unable to register clock notifier.\n");
> -		goto out_kfree;
> +		goto out_clk_unprepare;
>   	}
>   
>   	ttcce->ttc.freq = clk_get_rate(ttcce->ttc.clk);
> @@ -465,13 +465,15 @@ static int __init ttc_setup_clockevent(struct clk *clk,
>   	err = request_irq(irq, ttc_clock_event_interrupt,
>   			  IRQF_TIMER, ttcce->ce.name, ttcce);
>   	if (err)
> -		goto out_kfree;
> +		goto out_clk_unprepare;
>   
>   	clockevents_config_and_register(&ttcce->ce,
>   			ttcce->ttc.freq / PRESCALE, 1, 0xfffe);
>   
>   	return 0;
>   
> +out_clk_unprepare:
> +	clk_disable_unprepare(ttcce->ttc.clk);
>   out_kfree:
>   	kfree(ttcce);
>   	return err;

Reviewed-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal
diff mbox series

Patch

diff --git a/drivers/clocksource/timer-cadence-ttc.c b/drivers/clocksource/timer-cadence-ttc.c
index ca7a06489c40..b8a1cf59b9d6 100644
--- a/drivers/clocksource/timer-cadence-ttc.c
+++ b/drivers/clocksource/timer-cadence-ttc.c
@@ -435,7 +435,7 @@  static int __init ttc_setup_clockevent(struct clk *clk,
 				    &ttcce->ttc.clk_rate_change_nb);
 	if (err) {
 		pr_warn("Unable to register clock notifier.\n");
-		goto out_kfree;
+		goto out_clk_unprepare;
 	}
 
 	ttcce->ttc.freq = clk_get_rate(ttcce->ttc.clk);
@@ -465,13 +465,15 @@  static int __init ttc_setup_clockevent(struct clk *clk,
 	err = request_irq(irq, ttc_clock_event_interrupt,
 			  IRQF_TIMER, ttcce->ce.name, ttcce);
 	if (err)
-		goto out_kfree;
+		goto out_clk_unprepare;
 
 	clockevents_config_and_register(&ttcce->ce,
 			ttcce->ttc.freq / PRESCALE, 1, 0xfffe);
 
 	return 0;
 
+out_clk_unprepare:
+	clk_disable_unprepare(ttcce->ttc.clk);
 out_kfree:
 	kfree(ttcce);
 	return err;