@@ -977,7 +977,6 @@ static const struct acpi_device_id ec_device_ids[] = {
977
977
978
978
int __init acpi_ec_ecdt_probe (void )
979
979
{
980
- int ret ;
981
980
acpi_status status ;
982
981
struct acpi_table_ecdt * ecdt_ptr ;
983
982
@@ -1005,30 +1004,32 @@ int __init acpi_ec_ecdt_probe(void)
1005
1004
boot_ec -> gpe = ecdt_ptr -> gpe ;
1006
1005
boot_ec -> handle = ACPI_ROOT_OBJECT ;
1007
1006
acpi_get_handle (ACPI_ROOT_OBJECT , ecdt_ptr -> id , & boot_ec -> handle );
1008
- } else {
1009
- /* This workaround is needed only on some broken machines,
1010
- * which require early EC, but fail to provide ECDT */
1011
- acpi_handle x ;
1012
- printk (KERN_DEBUG PREFIX "Look up EC in DSDT\n" );
1013
- status = acpi_get_devices (ec_device_ids [0 ].id , ec_parse_device ,
1014
- boot_ec , NULL );
1015
- /* Check that acpi_get_devices actually find something */
1016
- if (ACPI_FAILURE (status ) || !boot_ec -> handle )
1017
- goto error ;
1018
- /* We really need to limit this workaround, the only ASUS,
1019
- * which needs it, has fake EC._INI method, so use it as flag.
1020
- * Keep boot_ec struct as it will be needed soon.
1021
- */
1022
- if (ACPI_FAILURE (acpi_get_handle (boot_ec -> handle , "_INI" , & x )))
1023
- return - ENODEV ;
1007
+ /* Add some basic check against completely broken table */
1008
+ if (boot_ec -> data_addr != boot_ec -> command_addr )
1009
+ goto install ;
1010
+ /* fall through */
1024
1011
}
1025
-
1026
- ret = ec_install_handlers (boot_ec );
1027
- if (!ret ) {
1012
+ /* This workaround is needed only on some broken machines,
1013
+ * which require early EC, but fail to provide ECDT */
1014
+ acpi_handle x ;
1015
+ printk (KERN_DEBUG PREFIX "Look up EC in DSDT\n" );
1016
+ status = acpi_get_devices (ec_device_ids [0 ].id , ec_parse_device ,
1017
+ boot_ec , NULL );
1018
+ /* Check that acpi_get_devices actually find something */
1019
+ if (ACPI_FAILURE (status ) || !boot_ec -> handle )
1020
+ goto error ;
1021
+ /* We really need to limit this workaround, the only ASUS,
1022
+ * which needs it, has fake EC._INI method, so use it as flag.
1023
+ * Keep boot_ec struct as it will be needed soon.
1024
+ */
1025
+ if (ACPI_FAILURE (acpi_get_handle (boot_ec -> handle , "_INI" , & x )))
1026
+ return - ENODEV ;
1027
+ install :
1028
+ if (!ec_install_handlers (boot_ec )) {
1028
1029
first_ec = boot_ec ;
1029
1030
return 0 ;
1030
1031
}
1031
- error :
1032
+ error :
1032
1033
kfree (boot_ec );
1033
1034
boot_ec = NULL ;
1034
1035
return - ENODEV ;
0 commit comments