linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] ARM: mmp: Add missing clk_disable_unprepare() in mmp_dt_init_timer()
@ 2022-09-07  6:14 Chen Lifu
  2022-10-08  8:43 ` chenlifu
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Lifu @ 2022-09-07  6:14 UTC (permalink / raw)
  To: lkundrak, linux, olof, pavel, linux-arm-kernel, linux-kernel; +Cc: chenlifu

mmp_dt_init_timer() may have called clk_prepare_enable() before return
from failed branches, add missing clk_disable_unprepare() in these cases.

Fixes: f36797ee4380 ("ARM: mmp/mmp2: dt: enable the clock")
Signed-off-by: Chen Lifu <chenlifu@huawei.com>
---
 arch/arm/mach-mmp/time.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index 41b2e8abc9e6..6d2db1fea1be 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -207,16 +207,20 @@ static int __init mmp_dt_init_timer(struct device_node *np)
 	} else {
 		rate = 3250000;
 	}
 
 	irq = irq_of_parse_and_map(np, 0);
-	if (!irq)
+	if (!irq) {
+		clk_disable_unprepare(clk);
 		return -EINVAL;
+	}
 
 	mmp_timer_base = of_iomap(np, 0);
-	if (!mmp_timer_base)
+	if (!mmp_timer_base) {
+		clk_disable_unprepare(clk);
 		return -ENOMEM;
+	}
 
 	mmp_timer_init(irq, rate);
 	return 0;
 }
 
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] ARM: mmp: Add missing clk_disable_unprepare() in mmp_dt_init_timer()
  2022-09-07  6:14 [PATCH -next] ARM: mmp: Add missing clk_disable_unprepare() in mmp_dt_init_timer() Chen Lifu
@ 2022-10-08  8:43 ` chenlifu
  0 siblings, 0 replies; 2+ messages in thread
From: chenlifu @ 2022-10-08  8:43 UTC (permalink / raw)
  To: lkundrak, linux, olof, pavel, linux-arm-kernel, linux-kernel

在 2022/9/7 14:14, Chen Lifu 写道:
> mmp_dt_init_timer() may have called clk_prepare_enable() before return
> from failed branches, add missing clk_disable_unprepare() in these cases.
> 
> Fixes: f36797ee4380 ("ARM: mmp/mmp2: dt: enable the clock")
> Signed-off-by: Chen Lifu <chenlifu@huawei.com>
> ---
>   arch/arm/mach-mmp/time.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
> index 41b2e8abc9e6..6d2db1fea1be 100644
> --- a/arch/arm/mach-mmp/time.c
> +++ b/arch/arm/mach-mmp/time.c
> @@ -207,16 +207,20 @@ static int __init mmp_dt_init_timer(struct device_node *np)
>   	} else {
>   		rate = 3250000;
>   	}
>   
>   	irq = irq_of_parse_and_map(np, 0);
> -	if (!irq)
> +	if (!irq) {
> +		clk_disable_unprepare(clk);
>   		return -EINVAL;
> +	}
>   
>   	mmp_timer_base = of_iomap(np, 0);
> -	if (!mmp_timer_base)
> +	if (!mmp_timer_base) {
> +		clk_disable_unprepare(clk);
>   		return -ENOMEM;
> +	}
>   
>   	mmp_timer_init(irq, rate);
>   	return 0;
>   }
>   
friendly ping ...

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-08  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07  6:14 [PATCH -next] ARM: mmp: Add missing clk_disable_unprepare() in mmp_dt_init_timer() Chen Lifu
2022-10-08  8:43 ` chenlifu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).