From f54ec8af333761e3bf6c2d347e1053d9fca8db6e Mon Sep 17 00:00:00 2001 From: Jamie Nguyen Date: Tue, 13 Oct 2026 12:39:00 -0700 Subject: [PATCH] ACPI: sysfs: Finish sysfs init when creating a table file fails If creating the file for a table fails, acpi_tables_sysfs_init() returns without sending the uevents for the tables directories, and acpi_sysfs_init() returns before creating the hotplug and pm_profile files. Stop creating table files at that point, but finish the rest of the initialization. Skipping only the failed table would give its file name to the next table with the same signature, so reading that file would return the failed table. Signed-off-by: Jamie Nguyen Link: https://patch.msgid.link/20261013193900.1258808-1-jamien@nvidia.com Signed-off-by: Rafael J. Wysocki --- drivers/acpi/sysfs.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index c7188d506dda..a4534b3e3cfb 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c @@ -516,7 +516,6 @@ static int acpi_tables_sysfs_init(void) struct acpi_table_header *table_header = NULL; int table_index; acpi_status status; - int ret; tables_kobj = kobject_create_and_add("tables", acpi_kobj); if (!tables_kobj) @@ -541,13 +540,11 @@ static int acpi_tables_sysfs_init(void) table_attr = kzalloc_obj(*table_attr); if (!table_attr) - return -ENOMEM; + break; - ret = acpi_table_attr_init(tables_kobj, - table_attr, table_header); - if (ret) { + if (acpi_table_attr_init(tables_kobj, table_attr, table_header)) { kfree(table_attr); - return ret; + break; } list_add_tail(&table_attr->node, &acpi_table_attr_list); acpi_table_data_init(table_header, table_attr);