Skip to content

Commit 20594cd

Browse files
kaushlenrafaeljw
authored andcommitted
ACPI: button: Call input_free_device() on failing input device registration
Make acpi_button_add() call input_free_device() when input_register_device() fails as required according to the documentation of the latter. Fixes: 0d51157 ("ACPI: button: Eliminate the driver notify callback") Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com> Cc: 6.5+ <stable@vger.kernel.org> # 6.5+ [ rjw: Subject and changelog rewrite, Fixes: tag ] Link: https://patch.msgid.link/20251006084706.971855-1-kaushlendra.kumar@intel.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 211ddde commit 20594cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/acpi/button.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,10 @@ static int acpi_button_add(struct acpi_device *device)
619619

620620
input_set_drvdata(input, device);
621621
error = input_register_device(input);
622-
if (error)
622+
if (error) {
623+
input_free_device(input);
623624
goto err_remove_fs;
625+
}
624626

625627
switch (device->device_type) {
626628
case ACPI_BUS_TYPE_POWER_BUTTON:

0 commit comments

Comments
 (0)