提交 e8b1b59d 编写于 作者: W Wei Yongjun 提交者: Len Brown

cpuidle / ACPI: fix potential NULL pointer dereference

The dereference should be moved below the NULL test.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)
Signed-off-by: NWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 f5a246ea
...@@ -1132,7 +1132,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) ...@@ -1132,7 +1132,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
int acpi_processor_hotplug(struct acpi_processor *pr) int acpi_processor_hotplug(struct acpi_processor *pr)
{ {
int ret = 0; int ret = 0;
struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); struct cpuidle_device *dev;
if (disabled_by_idle_boot_param()) if (disabled_by_idle_boot_param())
return 0; return 0;
...@@ -1147,6 +1147,7 @@ int acpi_processor_hotplug(struct acpi_processor *pr) ...@@ -1147,6 +1147,7 @@ int acpi_processor_hotplug(struct acpi_processor *pr)
if (!pr->flags.power_setup_done) if (!pr->flags.power_setup_done)
return -ENODEV; return -ENODEV;
dev = per_cpu(acpi_cpuidle_device, pr->id);
cpuidle_pause_and_lock(); cpuidle_pause_and_lock();
cpuidle_disable_device(dev); cpuidle_disable_device(dev);
acpi_processor_get_power_info(pr); acpi_processor_get_power_info(pr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册