clocksource/drivers/ingenic: Fix section mismatch
diff mbox series

Message ID 20201125102346.1816310-1-daniel.lezcano@linaro.org
State Accepted
Commit 5bd7cb29eceb52e4b108917786fdbf2a2c2048ef
Headers show
Series
  • clocksource/drivers/ingenic: Fix section mismatch
Related show

Commit Message

Daniel Lezcano Nov. 25, 2020, 10:23 a.m. UTC
The function ingenic_tcu_get_clock() is annotated for the __init
section but it is actually called from the online cpu callback.

That will lead to a crash if a CPU is hotplugged after boot time.

Remove the __init annotatation for the ingenic_tcu_get_clock()
function.

Fixes: f19d838d08fc (clocksource/drivers/ingenic: Add high resolution timer support for SMP/SMT)
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/ingenic-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul Cercueil Nov. 25, 2020, 10:45 a.m. UTC | #1
Hi Daniel,

Le mer. 25 nov. 2020 à 11:23, Daniel Lezcano 
<daniel.lezcano@linaro.org> a écrit :
> The function ingenic_tcu_get_clock() is annotated for the __init
> section but it is actually called from the online cpu callback.
> 
> That will lead to a crash if a CPU is hotplugged after boot time.
> 
> Remove the __init annotatation for the ingenic_tcu_get_clock()
> function.

One 'ta' too many ;)

> 
> Fixes: f19d838d08fc (clocksource/drivers/ingenic: Add high resolution 
> timer support for SMP/SMT)
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

With the above fixed:
Reviewed-by: Paul Cercueil <paul@crapouillou.net>

Cheers,
-Paul

> ---
>  drivers/clocksource/ingenic-timer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clocksource/ingenic-timer.c 
> b/drivers/clocksource/ingenic-timer.c
> index 58fd9189fab7..905fd6b163a8 100644
> --- a/drivers/clocksource/ingenic-timer.c
> +++ b/drivers/clocksource/ingenic-timer.c
> @@ -127,7 +127,7 @@ static irqreturn_t ingenic_tcu_cevt_cb(int irq, 
> void *dev_id)
>  	return IRQ_HANDLED;
>  }
> 
> -static struct clk * __init ingenic_tcu_get_clock(struct device_node 
> *np, int id)
> +static struct clk *ingenic_tcu_get_clock(struct device_node *np, int 
> id)
>  {
>  	struct of_phandle_args args;
> 
> --
> 2.25.1
>
Zhou Yanjie Nov. 25, 2020, 5:34 p.m. UTC | #2
Hi Daniel,

在 2020/11/25 下午6:23, Daniel Lezcano 写道:
> The function ingenic_tcu_get_clock() is annotated for the __init
> section but it is actually called from the online cpu callback.
>
> That will lead to a crash if a CPU is hotplugged after boot time.
>
> Remove the __init annotatation for the ingenic_tcu_get_clock()
> function.
>
> Fixes: f19d838d08fc (clocksource/drivers/ingenic: Add high resolution timer support for SMP/SMT)
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>   drivers/clocksource/ingenic-timer.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)


Works fine on JZ4780, X1000, and X1830.

Tested-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>


Thanks and best regards!


> diff --git a/drivers/clocksource/ingenic-timer.c b/drivers/clocksource/ingenic-timer.c
> index 58fd9189fab7..905fd6b163a8 100644
> --- a/drivers/clocksource/ingenic-timer.c
> +++ b/drivers/clocksource/ingenic-timer.c
> @@ -127,7 +127,7 @@ static irqreturn_t ingenic_tcu_cevt_cb(int irq, void *dev_id)
>   	return IRQ_HANDLED;
>   }
>   
> -static struct clk * __init ingenic_tcu_get_clock(struct device_node *np, int id)
> +static struct clk *ingenic_tcu_get_clock(struct device_node *np, int id)
>   {
>   	struct of_phandle_args args;
>

Patch
diff mbox series

diff --git a/drivers/clocksource/ingenic-timer.c b/drivers/clocksource/ingenic-timer.c
index 58fd9189fab7..905fd6b163a8 100644
--- a/drivers/clocksource/ingenic-timer.c
+++ b/drivers/clocksource/ingenic-timer.c
@@ -127,7 +127,7 @@  static irqreturn_t ingenic_tcu_cevt_cb(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static struct clk * __init ingenic_tcu_get_clock(struct device_node *np, int id)
+static struct clk *ingenic_tcu_get_clock(struct device_node *np, int id)
 {
 	struct of_phandle_args args;