linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: smp-cps: Fix potentially uninitialised value of core
@ 2017-03-31 10:51 Matt Redfearn
  2017-03-31 10:51 ` Matt Redfearn
  2017-04-12 19:35 ` Ralf Baechle
  0 siblings, 2 replies; 3+ messages in thread
From: Matt Redfearn @ 2017-03-31 10:51 UTC (permalink / raw)
  To: Ralf Baechle, James Hogan
  Cc: linux-mips, Matt Redfearn, Masahiro Yamada, linux-kernel,
	Paul Burton, Ingo Molnar, Andrew Morton

Turning on DEBUG in smp-cps.c, or compiling the kernel with
CONFIG_DYNAMIC_DEBUG enabled results the build error:

arch/mips/kernel/smp-cps.c: In function 'play_dead':
./include/linux/dynamic_debug.h:126:3: error: 'core' may be used
uninitialized in this function [-Werror=maybe-uninitialized]

Fix this by always initialising the variable.

Fixes: 0d2808f338c7 ("MIPS: smp-cps: Add support for CPU hotplug of MIPSr6 processors")
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>

---

 arch/mips/kernel/smp-cps.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
index 6d45f05538c8..795b4aaf8927 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -422,13 +422,12 @@ void play_dead(void)
 	local_irq_disable();
 	idle_task_exit();
 	cpu = smp_processor_id();
+	core = cpu_data[cpu].core;
 	cpu_death = CPU_DEATH_POWER;
 
 	pr_debug("CPU%d going offline\n", cpu);
 
 	if (cpu_has_mipsmt || cpu_has_vp) {
-		core = cpu_data[cpu].core;
-
 		/* Look for another online VPE within the core */
 		for_each_online_cpu(cpu_death_sibling) {
 			if (cpu_data[cpu_death_sibling].core != core)
-- 
2.7.4

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

* [PATCH] MIPS: smp-cps: Fix potentially uninitialised value of core
  2017-03-31 10:51 [PATCH] MIPS: smp-cps: Fix potentially uninitialised value of core Matt Redfearn
@ 2017-03-31 10:51 ` Matt Redfearn
  2017-04-12 19:35 ` Ralf Baechle
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Redfearn @ 2017-03-31 10:51 UTC (permalink / raw)
  To: Ralf Baechle, James Hogan
  Cc: linux-mips, Matt Redfearn, Masahiro Yamada, linux-kernel,
	Paul Burton, Ingo Molnar, Andrew Morton

Turning on DEBUG in smp-cps.c, or compiling the kernel with
CONFIG_DYNAMIC_DEBUG enabled results the build error:

arch/mips/kernel/smp-cps.c: In function 'play_dead':
./include/linux/dynamic_debug.h:126:3: error: 'core' may be used
uninitialized in this function [-Werror=maybe-uninitialized]

Fix this by always initialising the variable.

Fixes: 0d2808f338c7 ("MIPS: smp-cps: Add support for CPU hotplug of MIPSr6 processors")
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>

---

 arch/mips/kernel/smp-cps.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
index 6d45f05538c8..795b4aaf8927 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -422,13 +422,12 @@ void play_dead(void)
 	local_irq_disable();
 	idle_task_exit();
 	cpu = smp_processor_id();
+	core = cpu_data[cpu].core;
 	cpu_death = CPU_DEATH_POWER;
 
 	pr_debug("CPU%d going offline\n", cpu);
 
 	if (cpu_has_mipsmt || cpu_has_vp) {
-		core = cpu_data[cpu].core;
-
 		/* Look for another online VPE within the core */
 		for_each_online_cpu(cpu_death_sibling) {
 			if (cpu_data[cpu_death_sibling].core != core)
-- 
2.7.4

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

* Re: [PATCH] MIPS: smp-cps: Fix potentially uninitialised value of core
  2017-03-31 10:51 [PATCH] MIPS: smp-cps: Fix potentially uninitialised value of core Matt Redfearn
  2017-03-31 10:51 ` Matt Redfearn
@ 2017-04-12 19:35 ` Ralf Baechle
  1 sibling, 0 replies; 3+ messages in thread
From: Ralf Baechle @ 2017-04-12 19:35 UTC (permalink / raw)
  To: Matt Redfearn
  Cc: James Hogan, linux-mips, Masahiro Yamada, linux-kernel,
	Paul Burton, Ingo Molnar, Andrew Morton

Thanks, applied.

  Ralf

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

end of thread, other threads:[~2017-04-12 19:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-31 10:51 [PATCH] MIPS: smp-cps: Fix potentially uninitialised value of core Matt Redfearn
2017-03-31 10:51 ` Matt Redfearn
2017-04-12 19:35 ` Ralf Baechle

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).