diff mbox

ACPI button: don't try to use a non-existent lid device

Message ID 20091007143946.3fad3fa8@jbarnes-g45 (mailing list archive)
State Accepted
Headers show

Commit Message

Jesse Barnes Oct. 7, 2009, 9:39 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 9335b87..0c9c6a9 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -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))