Skip to content

Commit f900bf4

Browse files
guohanjunrafaeljw
authored andcommitted
ACPI: EC: Put the ACPI table after using it
The embedded controller boot resources table needs to be released after using it. Signed-off-by: Hanjun Guo <[email protected]> [ rjw: avoid adding a label in acpi_ec_ecdt_start() ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 11c7bdf commit f900bf4

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

drivers/acpi/ec.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,13 +1783,14 @@ static void __init acpi_ec_ecdt_start(void)
17831783
return;
17841784

17851785
status = acpi_get_handle(NULL, ecdt_ptr->id, &handle);
1786-
if (ACPI_FAILURE(status))
1787-
return;
1786+
if (ACPI_SUCCESS(status)) {
1787+
boot_ec->handle = handle;
17881788

1789-
boot_ec->handle = handle;
1789+
/* Add a special ACPI device object to represent the boot EC. */
1790+
acpi_bus_register_early_device(ACPI_BUS_TYPE_ECDT_EC);
1791+
}
17901792

1791-
/* Add a special ACPI device object to represent the boot EC. */
1792-
acpi_bus_register_early_device(ACPI_BUS_TYPE_ECDT_EC);
1793+
acpi_put_table((struct acpi_table_header *)ecdt_ptr);
17931794
}
17941795

17951796
/*
@@ -1891,12 +1892,12 @@ void __init acpi_ec_ecdt_probe(void)
18911892
* Asus X50GL:
18921893
* https://bugzilla.kernel.org/show_bug.cgi?id=11880
18931894
*/
1894-
return;
1895+
goto out;
18951896
}
18961897

18971898
ec = acpi_ec_alloc();
18981899
if (!ec)
1899-
return;
1900+
goto out;
19001901

19011902
if (EC_FLAGS_CORRECT_ECDT) {
19021903
ec->command_addr = ecdt_ptr->data.address;
@@ -1922,13 +1923,16 @@ void __init acpi_ec_ecdt_probe(void)
19221923
ret = acpi_ec_setup(ec, NULL);
19231924
if (ret) {
19241925
acpi_ec_free(ec);
1925-
return;
1926+
goto out;
19261927
}
19271928

19281929
boot_ec = ec;
19291930
boot_ec_is_ecdt = true;
19301931

19311932
pr_info("Boot ECDT EC used to handle transactions\n");
1933+
1934+
out:
1935+
acpi_put_table((struct acpi_table_header *)ecdt_ptr);
19321936
}
19331937

19341938
#ifdef CONFIG_PM_SLEEP

0 commit comments

Comments
 (0)