ACPI / PM: Fix possible NULL pointer deref in acpi_pm_device_sleep_state()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 27 Jun 2013 12:01:02 +0000 (14:01 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 28 Jun 2013 10:55:59 +0000 (12:55 +0200)
After commit fa1675b (ACPI / PM: Rework and clean up
acpi_dev_pm_get_state()) a NULL pointer dereference will take place
if NULL is passed to acpi_pm_device_sleep_state() as the second
argument.

Fix that by avoiding to use the pointer that may be NULL until
it's necessary to store a return value at the location pointed to
by it (if not NULL).

Reported-and-tested-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

No differences found