浏览代码

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

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>
Jesse Barnes 16 年之前
父节点
当前提交
2c907b72db
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      drivers/acpi/button.c

+ 3 - 0
drivers/acpi/button.c

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