arm: smp-twd: check for uninitialized clock in twd_cpufreq_init
PATCH 1/1 arm: smp-twd: check for uninitialized clock in twd_cpufreq_init
Non-smp platforms don't have local timer support, but the twd_cpufreq_init only checks for IS_ERR during init. Check against null also, to avoid crashes during cpufreq transitions on non-smp platforms.
--- arch/arm/kernel/smp_twd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/kernel/smp_twd.c +1 -1
@@ -129,7 +129,7 @@ static struct notifier_block twd_cpufreq_nb = {static int twd_cpufreq_init (void ) { -if (!IS_ERR (twd_clk)) +if (twd_clk && !IS_ERR (twd_clk))return cpufreq_register_notifier (&twd_cpufreq_nb,CPUFREQ_TRANSITION_NOTIFIER );
Signature · 1 line
1.7.4.1
PATCH 1/1 arm: smp-twd: check for uninitialized clock in twd_cpufreq_init
Quoted 6 lines · Tero Kristo
Non-smp platforms don't have local timer support, but the
twd_cpufreq_initonly checks forIS_ERRduring init. Check against null also, to avoid crashes during cpufreq transitions on non-smp platforms.Signed-off-by Tero Kristo <[email protected]>---
I sent a patch for the same issue which Kevin reported.
Thread.
http://www.spinics.net/lists/arm-kernel/msg160275.html
arch/arm/kernel/smp_twd.c static struct notifier_block twd_cpufreq_nb = { · line 132
Quoted 13 lines
?arch/arm/kernel/smp_twd.c | ? ?2 +-
?1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/kernel/smp_twd.c +1
-1@@ -129,7 +129,7 @@ static struct notifier_block twd_cpufreq_nb = { ?static int twd_cpufreq_init(void) ?{ - ? ? ? if (!IS_ERR(twd_clk)) + ? ? ? if (twd_clk && !IS_ERR(twd_clk))
Checking the clock node is not enoough because you can not have clock node and rely on calibration.. Testing twd_evt is safe to avoid the issue.
Regards
santosh
PATCH 1/1 arm: smp-twd: check for uninitialized clock in twd_cpufreq_init
Quoted 8 lines · Santosh
Quoted 6 lines · Tero Kristo
Non-smp platforms don't have local timer support, but the
twd_cpufreq_initonly checks forIS_ERRduring init. Check against null also, to avoid crashes during cpufreq transitions on non-smp platforms.Signed-off-by Tero Kristo <[email protected]>---
I sent a patch for the same issue which Kevin reported.
Oh sorry for the noise then. I did a quick search for a similar patch but didn't find one. This patch can be ignored.
-Tero
Quoted 24 lines
Thread.
http://www.spinics.net/lists/arm-kernel/msg160275.htmlarch/arm/kernel/smp_twd.c static struct notifier_block twd_cpufreq_nb = { · line 132
Quoted 13 lines
arch/arm/kernel/smp_twd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/kernel/smp_twd.c +1
-1@@ -129,7 +129,7 @@ static struct notifier_block twd_cpufreq_nb = {static int twd_cpufreq_init (void ) { -if (!IS_ERR (twd_clk)) +if (twd_clk && !IS_ERR (twd_clk))Checking the clock node is not enoough because you can not have clock node and rely on calibration.. Testing
twd_evtis safe to avoid the issue.Regards
santosh
PATCH 1/1 arm: smp-twd: check for uninitialized clock in twd_cpufreq_init
In reply to Tero KristoHello.
Quoted 14 lines · Tero Kristo
Non-smp platforms don't have local timer support, but the
twd_cpufreq_initonly checks forIS_ERRduring init. Check against null also, to avoid crashes during cpufreq transitions on non-smp platforms.Signed-off-by Tero Kristo <[email protected]>--- arch/arm/kernel/smp_twd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/kernel/smp_twd.c +0
-0
arch/arm/kernel/smp_twd.c static struct notifier_block twd_cpufreq_nb = { · line 132
Quoted 5 lines
arch/arm/kernel/smp_twd.c +1
-1@@ -129,7 +129,7 @@ static struct notifier_block twd_cpufreq_nb = {static int twd_cpufreq_init (void ) { -if (!IS_ERR (twd_clk)) +if (twd_clk&& !IS_ERR (twd_clk))
Why not !IS_ERR_OR_NULL(twd_clk)?
WBR, Sergei