summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-12-14 05:15:58 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-12-14 05:15:58 +0300
commitcc31e9b718dafd8a1bdc593234ddbbf4faa2511c (patch)
tree36b8c35ad5bbf07e4b4e6e7619f03f71d02dbe37 /drivers/acpi
parenta67485d4bf97918225dfb5246e531643755a7ee1 (diff)
parent28076483afac9dd77df269f5d460e51a09dfb19f (diff)
downloadlinux-cc31e9b718dafd8a1bdc593234ddbbf4faa2511c.tar.xz
Merge branch 'acpi-cppc'
* acpi-cppc: ACPI / CPPC: Fix per-CPU pointer management in acpi_cppc_processor_probe() ACPI / CPPC: Fix crash in acpi_cppc_processor_exit()
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/cppc_acpi.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index e0ea8f56d2bf..3ca0729f7e0e 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -776,9 +776,6 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
init_waitqueue_head(&pcc_data.pcc_write_wait_q);
}
- /* Plug PSD data into this CPUs CPC descriptor. */
- per_cpu(cpc_desc_ptr, pr->id) = cpc_ptr;
-
/* Everything looks okay */
pr_debug("Parsed CPC struct for CPU: %d\n", pr->id);
@@ -789,10 +786,15 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
goto out_free;
}
+ /* Plug PSD data into this CPUs CPC descriptor. */
+ per_cpu(cpc_desc_ptr, pr->id) = cpc_ptr;
+
ret = kobject_init_and_add(&cpc_ptr->kobj, &cppc_ktype, &cpu_dev->kobj,
"acpi_cppc");
- if (ret)
+ if (ret) {
+ per_cpu(cpc_desc_ptr, pr->id) = NULL;
goto out_free;
+ }
kfree(output.pointer);
return 0;
@@ -826,6 +828,8 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr)
void __iomem *addr;
cpc_ptr = per_cpu(cpc_desc_ptr, pr->id);
+ if (!cpc_ptr)
+ return;
/* Free all the mapped sys mem areas for this CPU */
for (i = 2; i < cpc_ptr->num_entries; i++) {