Skip to content

Commit

Permalink
cpuidle / ACPI: fix potential NULL pointer dereference
Browse files Browse the repository at this point in the history
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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Wei Yongjun authored and Len Brown committed Oct 9, 2012
1 parent f5a246e commit e8b1b59
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/acpi/processor_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
int acpi_processor_hotplug(struct acpi_processor *pr)
{
int ret = 0;
struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id);
struct cpuidle_device *dev;

if (disabled_by_idle_boot_param())
return 0;
Expand All @@ -1147,6 +1147,7 @@ int acpi_processor_hotplug(struct acpi_processor *pr)
if (!pr->flags.power_setup_done)
return -ENODEV;

dev = per_cpu(acpi_cpuidle_device, pr->id);
cpuidle_pause_and_lock();
cpuidle_disable_device(dev);
acpi_processor_get_power_info(pr);
Expand Down

0 comments on commit e8b1b59

Please sign in to comment.