summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/power.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 67dedeed144..792a8309d07 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -465,10 +465,12 @@ int acpi_power_transition(struct acpi_device *device, int state)
struct acpi_handle_list *tl = NULL; /* Target Resources */
int i = 0;
-
if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
return -EINVAL;
+ if (device->power.state == state)
+ return 0;
+
if ((device->power.state < ACPI_STATE_D0)
|| (device->power.state > ACPI_STATE_D3))
return -ENODEV;
@@ -488,10 +490,6 @@ int acpi_power_transition(struct acpi_device *device, int state)
goto end;
}
- if (device->power.state == state) {
- goto end;
- }
-
/*
* Then we dereference all power resources used in the current list.
*/