ACPI button: don't try to use a non-existent lid device
authorJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 7 Oct 2009 21:39:46 +0000 (14:39 -0700)
committerLen Brown <len.brown@intel.com>
Tue, 13 Oct 2009 06:53:30 +0000 (02:53 -0400)
If a call comes in to check the lid state but there's no lid device
present, we should return -ENODEV.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/button.c

index 9335b87c51747a6f480017e5bf94d92c97b173cc..0c9c6a9a002cb397867269e7bc44f56d4bd9f9bd 100644 (file)
@@ -251,6 +251,9 @@ int acpi_lid_open(void)
        acpi_status status;
        unsigned long long state;
 
+       if (!lid_device)
+               return -ENODEV;
+
        status = acpi_evaluate_integer(lid_device->handle, "_LID", NULL,
                                       &state);
        if (ACPI_FAILURE(status))