]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/acpi/sleep/main.c
ACPI: Fix acpi_pm_device_sleep_state()
[karo-tx-linux.git] / drivers / acpi / sleep / main.c
index 2c0b6630f8ba54603530fce4574f8697faaabe9e..99181c8f023e995ddee02db168d9ef682a74bd4e 100644 (file)
@@ -386,11 +386,20 @@ int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p)
        if (acpi_target_sleep_state == ACPI_STATE_S0 ||
            (wake && adev->wakeup.state.enabled &&
             adev->wakeup.sleep_state <= acpi_target_sleep_state)) {
+               acpi_status status;
+
                acpi_method[3] = 'W';
-               acpi_evaluate_integer(handle, acpi_method, NULL, &d_max);
-               /* Sanity check */
-               if (d_max < d_min)
+               status = acpi_evaluate_integer(handle, acpi_method, NULL,
+                                               &d_max);
+               if (ACPI_FAILURE(status)) {
+                       d_max = d_min;
+               } else if (d_max < d_min) {
+                       /* Warn the user of the broken DSDT */
+                       printk(KERN_WARNING "ACPI: Wrong value from %s\n",
+                               acpi_method);
+                       /* Sanitize it */
                        d_min = d_max;
+               }
        }
 
        if (d_min_p)