]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ACPI / utils: Drop reference in test for device presence
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 18 Mar 2019 18:47:09 +0000 (21:47 +0300)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1838349
[ Upstream commit 54e3aca84e571559915998aa6cc05e5ac37c043b ]

When commit 8661423eea1a ("ACPI / utils: Add new acpi_dev_present
helper") introduced acpi_dev_present(), it missed the fact that
bus_find_device() took a reference on the device found by it and
the callers of acpi_dev_present() don't drop that reference.

Drop the reference on the device in acpi_dev_present().

Fixes: 8661423eea1a ("ACPI / utils: Add new acpi_dev_present helper")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/acpi/utils.c

index 9d49a1acebe39a318cdfd18fe6502e4c97d816c5..4472047c1ffb3cb23c9817cf6963422b4ba90382 100644 (file)
@@ -799,6 +799,7 @@ bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
        dev = bus_find_device(&acpi_bus_type, NULL, &match,
                              acpi_dev_present_cb);
 
+       put_device(dev);
        return !!dev;
 }
 EXPORT_SYMBOL(acpi_dev_present);