aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/coretemp.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 5850da64ae28..baa842a80b4b 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -491,14 +491,22 @@ exit:
491 491
492static void coretemp_device_remove(unsigned int cpu) 492static void coretemp_device_remove(unsigned int cpu)
493{ 493{
494 struct pdev_entry *p, *n; 494 struct pdev_entry *p;
495 unsigned int i;
496
495 mutex_lock(&pdev_list_mutex); 497 mutex_lock(&pdev_list_mutex);
496 list_for_each_entry_safe(p, n, &pdev_list, list) { 498 list_for_each_entry(p, &pdev_list, list) {
497 if (p->cpu == cpu) { 499 if (p->cpu != cpu)
498 platform_device_unregister(p->pdev); 500 continue;
499 list_del(&p->list); 501
500 kfree(p); 502 platform_device_unregister(p->pdev);
501 } 503 list_del(&p->list);
504 mutex_unlock(&pdev_list_mutex);
505 kfree(p);
506 for_each_cpu(i, cpu_sibling_mask(cpu))
507 if (i != cpu && !coretemp_device_add(i))
508 break;
509 return;
502 } 510 }
503 mutex_unlock(&pdev_list_mutex); 511 mutex_unlock(&pdev_list_mutex);
504} 512}