]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ACPI: button: Call input_free_device() on failing input device registration
authorKaushlendra Kumar <kaushlendra.kumar@intel.com>
Mon, 6 Oct 2025 08:47:06 +0000 (14:17 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:33:55 +0000 (15:33 -0500)
commit 20594cd104abaaabb676c7a2915b150ae5ff093d upstream.

Make acpi_button_add() call input_free_device() when
input_register_device() fails as required according to the
documentation of the latter.

Fixes: 0d51157dfaac ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/button.c

index 7773e6b860e73bef6231504e3aa1ee8ef30d8917..6d7c413982167e14ed12f9a802387832ab2a0e75 100644 (file)
@@ -613,8 +613,10 @@ static int acpi_button_add(struct acpi_device *device)
 
        input_set_drvdata(input, device);
        error = input_register_device(input);
-       if (error)
+       if (error) {
+               input_free_device(input);
                goto err_remove_fs;
+       }
 
        switch (device->device_type) {
        case ACPI_BUS_TYPE_POWER_BUTTON: