Commit c5279dee authored by Alexey Starikovskiy's avatar Alexey Starikovskiy Committed by Len Brown

ACPI: EC: Add some basic check for ECDT data

One more ASUS comes with empty ECDT, add a guard for it...

http://bugzilla.kernel.org/show_bug.cgi?id=11880Signed-off-by: default avatarAlexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent ed313489
...@@ -977,7 +977,6 @@ static const struct acpi_device_id ec_device_ids[] = { ...@@ -977,7 +977,6 @@ static const struct acpi_device_id ec_device_ids[] = {
int __init acpi_ec_ecdt_probe(void) int __init acpi_ec_ecdt_probe(void)
{ {
int ret;
acpi_status status; acpi_status status;
struct acpi_table_ecdt *ecdt_ptr; struct acpi_table_ecdt *ecdt_ptr;
...@@ -1005,7 +1004,11 @@ int __init acpi_ec_ecdt_probe(void) ...@@ -1005,7 +1004,11 @@ int __init acpi_ec_ecdt_probe(void)
boot_ec->gpe = ecdt_ptr->gpe; boot_ec->gpe = ecdt_ptr->gpe;
boot_ec->handle = ACPI_ROOT_OBJECT; boot_ec->handle = ACPI_ROOT_OBJECT;
acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle);
} else { /* Add some basic check against completely broken table */
if (boot_ec->data_addr != boot_ec->command_addr)
goto install;
/* fall through */
}
/* This workaround is needed only on some broken machines, /* This workaround is needed only on some broken machines,
* which require early EC, but fail to provide ECDT */ * which require early EC, but fail to provide ECDT */
acpi_handle x; acpi_handle x;
...@@ -1021,14 +1024,12 @@ int __init acpi_ec_ecdt_probe(void) ...@@ -1021,14 +1024,12 @@ int __init acpi_ec_ecdt_probe(void)
*/ */
if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
return -ENODEV; return -ENODEV;
} install:
if (!ec_install_handlers(boot_ec)) {
ret = ec_install_handlers(boot_ec);
if (!ret) {
first_ec = boot_ec; first_ec = boot_ec;
return 0; return 0;
} }
error: error:
kfree(boot_ec); kfree(boot_ec);
boot_ec = NULL; boot_ec = NULL;
return -ENODEV; return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment