[PATCH v1 3/3] ACPI: button: Add missing device class clearing on probe failures

Rafael J. Wysocki posted 1 patch 3 days, 5 hours ago
drivers/acpi/button.c |    1 +
1 file changed, 1 insertion(+)
[PATCH v1 3/3] ACPI: button: Add missing device class clearing on probe failures
Posted by Rafael J. Wysocki 3 days, 5 hours ago
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Commit e18947038bf4 ("ACPI: driver: Do not set acpi_device_class()
unnecessarily") modified acpi_button_remove() to clear the device class
field in struct acpi_device on driver removal, but it should also have
updated the rollback path in acpi_button_probe(), which it didn't do,
so do it now.

Fixes: e18947038bf4 ("ACPI: driver: Do not set acpi_device_class() unnecessarily")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/button.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -687,6 +687,7 @@ err_remove_fs:
 	acpi_button_remove_fs(button);
 err_free_button:
 	kfree(button);
+	memset(acpi_device_class(device), 0, sizeof(acpi_device_class));
 	return error;
 }
Re: [PATCH v1 3/3] ACPI: button: Add missing device class clearing on probe failures
Posted by Mario Limonciello 3 days, 5 hours ago
On 5/21/26 08:39, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Commit e18947038bf4 ("ACPI: driver: Do not set acpi_device_class()
> unnecessarily") modified acpi_button_remove() to clear the device class
> field in struct acpi_device on driver removal, but it should also have
> updated the rollback path in acpi_button_probe(), which it didn't do,
> so do it now.
> 
> Fixes: e18947038bf4 ("ACPI: driver: Do not set acpi_device_class() unnecessarily")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>

> ---
>   drivers/acpi/button.c |    1 +
>   1 file changed, 1 insertion(+)
> 
> --- a/drivers/acpi/button.c
> +++ b/drivers/acpi/button.c
> @@ -687,6 +687,7 @@ err_remove_fs:
>   	acpi_button_remove_fs(button);
>   err_free_button:
>   	kfree(button);
> +	memset(acpi_device_class(device), 0, sizeof(acpi_device_class));
>   	return error;
>   }
>   
> 
> 
>