Commit f6aeccdb96fc0555e939dd507702922f07dcbcbb

Authored by Jan Beulich
Committed by Guenter Roeck
1 parent a46590533a

x86/hwmon: fix initialization of pkgtemp

Feature availability should also be checked in the hotplug code path.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>

Showing 1 changed file with 3 additions and 7 deletions Side-by-side Diff

drivers/hwmon/pkgtemp.c
... ... @@ -284,10 +284,11 @@
284 284 int err;
285 285 struct platform_device *pdev;
286 286 struct pdev_entry *pdev_entry;
287   -#ifdef CONFIG_SMP
288 287 struct cpuinfo_x86 *c = &cpu_data(cpu);
289   -#endif
290 288  
  289 + if (!cpu_has(c, X86_FEATURE_PTS))
  290 + return 0;
  291 +
291 292 mutex_lock(&pdev_list_mutex);
292 293  
293 294 #ifdef CONFIG_SMP
... ... @@ -403,11 +404,6 @@
403 404 goto exit;
404 405  
405 406 for_each_online_cpu(i) {
406   - struct cpuinfo_x86 *c = &cpu_data(i);
407   -
408   - if (!cpu_has(c, X86_FEATURE_PTS))
409   - continue;
410   -
411 407 err = pkgtemp_device_add(i);
412 408 if (err)
413 409 goto exit_devices_unreg;