aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 573458f1caf2..b87e0b6970cb 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -348,10 +348,12 @@ static void amd_pmu_cpu_offline(int cpu)
348 348
349 raw_spin_lock(&amd_nb_lock); 349 raw_spin_lock(&amd_nb_lock);
350 350
351 if (--cpuhw->amd_nb->refcnt == 0) 351 if (cpuhw->amd_nb) {
352 kfree(cpuhw->amd_nb); 352 if (--cpuhw->amd_nb->refcnt == 0)
353 kfree(cpuhw->amd_nb);
353 354
354 cpuhw->amd_nb = NULL; 355 cpuhw->amd_nb = NULL;
356 }
355 357
356 raw_spin_unlock(&amd_nb_lock); 358 raw_spin_unlock(&amd_nb_lock);
357} 359}