aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/x86_pkg_temp_thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal/x86_pkg_temp_thermal.c')
-rw-r--r--drivers/thermal/x86_pkg_temp_thermal.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c
index 034604c021d6..cf172d50b5d3 100644
--- a/drivers/thermal/x86_pkg_temp_thermal.c
+++ b/drivers/thermal/x86_pkg_temp_thermal.c
@@ -394,6 +394,7 @@ static int pkg_temp_thermal_device_add(unsigned int cpu)
394 char buffer[30]; 394 char buffer[30];
395 int thres_count; 395 int thres_count;
396 u32 eax, ebx, ecx, edx; 396 u32 eax, ebx, ecx, edx;
397 u8 *temp;
397 398
398 cpuid(6, &eax, &ebx, &ecx, &edx); 399 cpuid(6, &eax, &ebx, &ecx, &edx);
399 thres_count = ebx & 0x07; 400 thres_count = ebx & 0x07;
@@ -417,13 +418,14 @@ static int pkg_temp_thermal_device_add(unsigned int cpu)
417 spin_lock(&pkg_work_lock); 418 spin_lock(&pkg_work_lock);
418 if (topology_physical_package_id(cpu) > max_phy_id) 419 if (topology_physical_package_id(cpu) > max_phy_id)
419 max_phy_id = topology_physical_package_id(cpu); 420 max_phy_id = topology_physical_package_id(cpu);
420 pkg_work_scheduled = krealloc(pkg_work_scheduled, 421 temp = krealloc(pkg_work_scheduled,
421 (max_phy_id+1) * sizeof(u8), GFP_ATOMIC); 422 (max_phy_id+1) * sizeof(u8), GFP_ATOMIC);
422 if (!pkg_work_scheduled) { 423 if (!temp) {
423 spin_unlock(&pkg_work_lock); 424 spin_unlock(&pkg_work_lock);
424 err = -ENOMEM; 425 err = -ENOMEM;
425 goto err_ret_free; 426 goto err_ret_free;
426 } 427 }
428 pkg_work_scheduled = temp;
427 pkg_work_scheduled[topology_physical_package_id(cpu)] = 0; 429 pkg_work_scheduled[topology_physical_package_id(cpu)] = 0;
428 spin_unlock(&pkg_work_lock); 430 spin_unlock(&pkg_work_lock);
429 431