Skip to content

Commit

Permalink
x86 / perf: Fix suspend to RAM on HP nx6325
Browse files Browse the repository at this point in the history
Commit 3f6da39
(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>
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Mar 22, 2010
1 parent 220bf99 commit a90110c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arch/x86/kernel/cpu/perf_event_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,12 @@ static void amd_pmu_cpu_offline(int cpu)

raw_spin_lock(&amd_nb_lock);

if (--cpuhw->amd_nb->refcnt == 0)
kfree(cpuhw->amd_nb);
if (cpuhw->amd_nb) {
if (--cpuhw->amd_nb->refcnt == 0)
kfree(cpuhw->amd_nb);

cpuhw->amd_nb = NULL;
cpuhw->amd_nb = NULL;
}

raw_spin_unlock(&amd_nb_lock);
}
Expand Down

0 comments on commit a90110c

Please sign in to comment.