mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ACPI: sysfs: Finish sysfs init when creating a table file fails
@ 2026-10-13 19:39 Jamie Nguyen
  0 siblings, 0 replies; only message in thread
From: Jamie Nguyen @ 2026-10-13 19:39 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, Tony Luck, Punit Agrawal, linux-acpi, linux-kernel

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.

Assisted-by: LLM
Signed-off-by: Jamie Nguyen <jamien@nvidia.com>
---
This was noted in the review of the BDAT v1 patch:
https://lore.kernel.org/r/CAJZ5v0hM+6RvyXwG89Jyyu48jxSejNwsDt-H=2Y2dkt--af2QA@mail.gmail.com.
Handling it as a standalone patch here.

Tested on an arm64 server with test-only changes that make creating
one table's file fail at boot (FPDT, or the second SSDT). Without this
patch, pm_profile and hotplug are missing. With it, they are created,
and every table file created before the failure matches a normal boot.

 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 dd4a99f09efea65..7dfbb19238ad906 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -510,7 +510,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)
@@ -535,13 +534,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);
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-13 19:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-13 19:39 [PATCH] ACPI: sysfs: Finish sysfs init when creating a table file fails Jamie Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®