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>
This commit is contained in:
committed by
Ingo Molnar
parent
af6af30c0f
commit
e0d82a0a4e
@@ -537,7 +537,8 @@ static struct power_pmu power6_pmu = {
|
||||
|
||||
static int init_power6_pmu(void)
|
||||
{
|
||||
if (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power6"))
|
||||
if (!cur_cpu_spec->oprofile_cpu_type ||
|
||||
strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power6"))
|
||||
return -ENODEV;
|
||||
|
||||
return register_power_pmu(&power6_pmu);
|
||||
|
Reference in New Issue
Block a user