diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2010-03-21 16:51:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-22 12:57:19 -0400 |
commit | a90110c61073eab95d1986322693c2b9a8a6a5f6 (patch) | |
tree | 1201992d50a5b4f9249d21b8d65115402c314df1 /arch | |
parent | 220bf991b0366cc50a94feede3d7341fa5710ee4 (diff) |
x86 / perf: Fix suspend to RAM on HP nx6325
Commit 3f6da3905398826d85731247e7fbcf53400c18bd
(perf: Rework and fix the arch CPU-hotplug hooks) broke suspend to
RAM on my HP nx6325 (and most likely on other AMD-based boxes too)
by allowing amd_pmu_cpu_offline() to be executed for CPUs that are
going offline as part of the suspend process. The problem is that
cpuhw->amd_nb may be NULL already, so the function should make sure
it's not NULL before accessing the object pointed to by it.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_amd.c | 8 |
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 | } |