Re: [PATCH] ACPI: sysfs: Finish sysfs init when creating a table file fails
From: Rafael J. Wysocki (Intel)
Date: Thu Oct 22 2026 - 14:46:46 EST
On Tue, Oct 13, 2026 at 9:39 PM Jamie Nguyen <jamien@xxxxxxxxxx> wrote:
>
> 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@xxxxxxxxxx>
> ---
> This was noted in the review of the BDAT v1 patch:
> https://lore.kernel.org/r/CAJZ5v0hM+6RvyXwG89Jyyu48jxSejNwsDt-H=2Y2dkt--af2QA@xxxxxxxxxxxxxx.
> 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);
> --
Sashiko has some feedback on this:
https://sashiko.dev/#/patchset/20261013193900.1258808-1-jamien%40nvidia.com
but that's about a pre-existing issue AFAICS, so applied as 7.4-rc material.
Thanks!