Commit 0f86267b authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'hwmon-for-linus' of git://github.com/groeck/linux

* 'hwmon-for-linus' of git://github.com/groeck/linux:
  hwmon: (coretemp) Avoid leaving around dangling pointer
  hwmon: (coretemp) Fixup platform device ID change
parents 0d617928 20ecb499
...@@ -377,9 +377,9 @@ static int create_core_attrs(struct temp_data *tdata, struct device *dev, ...@@ -377,9 +377,9 @@ static int create_core_attrs(struct temp_data *tdata, struct device *dev,
} }
static int __devinit chk_ucode_version(struct platform_device *pdev) static int __cpuinit chk_ucode_version(unsigned int cpu)
{ {
struct cpuinfo_x86 *c = &cpu_data(pdev->id); struct cpuinfo_x86 *c = &cpu_data(cpu);
int err; int err;
u32 edx; u32 edx;
...@@ -390,17 +390,15 @@ static int __devinit chk_ucode_version(struct platform_device *pdev) ...@@ -390,17 +390,15 @@ static int __devinit chk_ucode_version(struct platform_device *pdev)
*/ */
if (c->x86_model == 0xe && c->x86_mask < 0xc) { if (c->x86_model == 0xe && c->x86_mask < 0xc) {
/* check for microcode update */ /* check for microcode update */
err = smp_call_function_single(pdev->id, get_ucode_rev_on_cpu, err = smp_call_function_single(cpu, get_ucode_rev_on_cpu,
&edx, 1); &edx, 1);
if (err) { if (err) {
dev_err(&pdev->dev, pr_err("Cannot determine microcode revision of "
"Cannot determine microcode revision of " "CPU#%u (%d)!\n", cpu, err);
"CPU#%u (%d)!\n", pdev->id, err);
return -ENODEV; return -ENODEV;
} else if (edx < 0x39) { } else if (edx < 0x39) {
dev_err(&pdev->dev, pr_err("Errata AE18 not fixed, update BIOS or "
"Errata AE18 not fixed, update BIOS or " "microcode of the CPU!\n");
"microcode of the CPU!\n");
return -ENODEV; return -ENODEV;
} }
} }
...@@ -508,6 +506,7 @@ static int create_core_data(struct platform_device *pdev, ...@@ -508,6 +506,7 @@ static int create_core_data(struct platform_device *pdev,
return 0; return 0;
exit_free: exit_free:
pdata->core_data[attr_no] = NULL;
kfree(tdata); kfree(tdata);
return err; return err;
} }
...@@ -544,11 +543,6 @@ static int __devinit coretemp_probe(struct platform_device *pdev) ...@@ -544,11 +543,6 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
struct platform_data *pdata; struct platform_data *pdata;
int err; int err;
/* Check the microcode version of the CPU */
err = chk_ucode_version(pdev);
if (err)
return err;
/* Initialize the per-package data structures */ /* Initialize the per-package data structures */
pdata = kzalloc(sizeof(struct platform_data), GFP_KERNEL); pdata = kzalloc(sizeof(struct platform_data), GFP_KERNEL);
if (!pdata) if (!pdata)
...@@ -630,7 +624,7 @@ static int __cpuinit coretemp_device_add(unsigned int cpu) ...@@ -630,7 +624,7 @@ static int __cpuinit coretemp_device_add(unsigned int cpu)
} }
pdev_entry->pdev = pdev; pdev_entry->pdev = pdev;
pdev_entry->phys_proc_id = TO_PHYS_ID(cpu); pdev_entry->phys_proc_id = pdev->id;
list_add_tail(&pdev_entry->list, &pdev_list); list_add_tail(&pdev_entry->list, &pdev_list);
mutex_unlock(&pdev_list_mutex); mutex_unlock(&pdev_list_mutex);
...@@ -691,6 +685,10 @@ static void __cpuinit get_core_online(unsigned int cpu) ...@@ -691,6 +685,10 @@ static void __cpuinit get_core_online(unsigned int cpu)
return; return;
if (!pdev) { if (!pdev) {
/* Check the microcode version of the CPU */
if (chk_ucode_version(cpu))
return;
/* /*
* Alright, we have DTS support. * Alright, we have DTS support.
* We are bringing the _first_ core in this pkg * We are bringing the _first_ core in this pkg
......
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