Skip to contentSkip to conversation

powerpc: Fix setting of oprofile cpu type

PATCH New Benjamin Herrenschmidt 1 participant 1 message Apr 30, 2009 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Fix setting of oprofile cpu type

commit 2657dd4e301d4841ed67a4fac7d145ad8f3e1b28 introduced a bug where we would now always override the "real" oprofile CPU type with the "compatible" one provided by a pseudo-PVR in the device-tree which is incorrect and breaks oprofile on all current configs since the "compatible" ones aren't yet recognized.

This fixes it.

---

Bug hit 2.6.29 too. I'll send this to Linus and Greg tomorrow unless somebody thinks it's wrong. I've tested on POWER6 and verified the bug and the fix.

 arch/powerpc/kernel/cputable.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/cputable.c +2 -2
@@ -1833,8 +1833,8 @@ static void __init setup_cpu_spec(unsign
 		 * and, in that case, keep the current value for
 		 * oprofile_cpu_type.
 		 */
-		if (old.oprofile_cpu_type == NULL)
-			t->oprofile_cpu_type = s->oprofile_cpu_type;
+		if (old.oprofile_cpu_type != NULL)
+			t->oprofile_cpu_type = old.oprofile_cpu_type;
 	}
 
 	*PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;