Commit a90110c6 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Linus Torvalds

x86 / perf: Fix suspend to RAM on HP nx6325

Commit 3f6da390
(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: default avatarRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 220bf991
...@@ -348,10 +348,12 @@ static void amd_pmu_cpu_offline(int cpu) ...@@ -348,10 +348,12 @@ static void amd_pmu_cpu_offline(int cpu)
raw_spin_lock(&amd_nb_lock); raw_spin_lock(&amd_nb_lock);
if (--cpuhw->amd_nb->refcnt == 0) if (cpuhw->amd_nb) {
kfree(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); raw_spin_unlock(&amd_nb_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment