diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-08-06 07:16:44 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-06 07:55:09 -0400 |
commit | e0d82a0a4e9841b787e6431ccfbb515546c55dc2 (patch) | |
tree | 5fe4ea05533ca0c60f90e27bd5fd9c3aacbcd668 /arch/powerpc/kernel/power5+-pmu.c | |
parent | af6af30c0fcd77e621638e53ef8b176bca8bd3b4 (diff) |
perf_counter/powerpc: Check oprofile_cpu_type for NULL before using it
If the current CPU doesn't support performance counters,
cur_cpu_spec->oprofile_cpu_type can be NULL. The current
perf_counter modules don't test for that case and would thus
crash at boot time.
Bug reported by David Woodhouse.
Reported-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Paul Mackerras <paulus@samba.org>
LKML-Reference: <19066.48028.446975.501454@cargo.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/powerpc/kernel/power5+-pmu.c')
-rw-r--r-- | arch/powerpc/kernel/power5+-pmu.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/power5+-pmu.c b/arch/powerpc/kernel/power5+-pmu.c index f4adca8e98a4..31918af3e355 100644 --- a/arch/powerpc/kernel/power5+-pmu.c +++ b/arch/powerpc/kernel/power5+-pmu.c | |||
@@ -678,8 +678,9 @@ static struct power_pmu power5p_pmu = { | |||
678 | 678 | ||
679 | static int init_power5p_pmu(void) | 679 | static int init_power5p_pmu(void) |
680 | { | 680 | { |
681 | if (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5+") | 681 | if (!cur_cpu_spec->oprofile_cpu_type || |
682 | && strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5++")) | 682 | (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5+") |
683 | && strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5++"))) | ||
683 | return -ENODEV; | 684 | return -ENODEV; |
684 | 685 | ||
685 | return register_power_pmu(&power5p_pmu); | 686 | return register_power_pmu(&power5p_pmu); |