aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki2021-07-23 17:06:15 +0200
committerRafael J. Wysocki2021-07-23 17:06:15 +0200
commit0b8a53a8444c267114f6b5a85d21153ddea190eb (patch)
tree760576b9b9f0b1b335fd4102b027a7bed6e8e3c4 /drivers/acpi
parentd2cbbf1fe503c07e466c62f83aa1926d74d15821 (diff)
parent71f6428332844f38c7cb10461d9f29e9c9b983a0 (diff)
Merge branch 'acpi-utils'
* acpi-utils: ACPI: utils: Fix reference counting in for_each_acpi_dev_match()
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/utils.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index e7ddd281afff..d5cedffeeff9 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -860,11 +860,9 @@ EXPORT_SYMBOL(acpi_dev_present);
* Return the next match of ACPI device if another matching device was present
* at the moment of invocation, or NULL otherwise.
*
- * FIXME: The function does not tolerate the sudden disappearance of @adev, e.g.
- * in the case of a hotplug event. That said, the caller should ensure that
- * this will never happen.
- *
* The caller is responsible for invoking acpi_dev_put() on the returned device.
+ * On the other hand the function invokes acpi_dev_put() on the given @adev
+ * assuming that its reference counter had been increased beforehand.
*
* See additional information in acpi_dev_present() as well.
*/
@@ -880,6 +878,7 @@ acpi_dev_get_next_match_dev(struct acpi_device *adev, const char *hid, const cha
match.hrv = hrv;
dev = bus_find_device(&acpi_bus_type, start, &match, acpi_dev_match_cb);
+ acpi_dev_put(adev);
return dev ? to_acpi_device(dev) : NULL;
}
EXPORT_SYMBOL(acpi_dev_get_next_match_dev);