summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2015-11-25 21:19:55 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-12-09 01:30:26 +0100
commitca9dc8d42b30e2d766b471fe5ecf0c71fd309c8f (patch)
treee6aab971b8171fcacee6c9e718111b6e7d6c5d90 /drivers/acpi/scan.c
parente399037e06beec6d190a302ff5e4fee4aae77c50 (diff)
downloadop-kernel-dev-ca9dc8d42b30e2d766b471fe5ecf0c71fd309c8f.zip
op-kernel-dev-ca9dc8d42b30e2d766b471fe5ecf0c71fd309c8f.tar.gz
ACPI / scan: Fix acpi_bus_id_list bookkeeping
acpi_device_add() allocates and adds an element to acpi_bus_id_list (or increments the instance count if the device's HID is already present in the list), but the element is never deleted from the list nor freed. Fix it. Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index ddfed0d..be1fc12 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -471,10 +471,24 @@ static void acpi_device_release(struct device *dev)
static void acpi_device_del(struct acpi_device *device)
{
+ struct acpi_device_bus_id *acpi_device_bus_id;
+
mutex_lock(&acpi_device_lock);
if (device->parent)
list_del(&device->node);
+ list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node)
+ if (!strcmp(acpi_device_bus_id->bus_id,
+ acpi_device_hid(device))) {
+ if (acpi_device_bus_id->instance_no > 0)
+ acpi_device_bus_id->instance_no--;
+ else {
+ list_del(&acpi_device_bus_id->node);
+ kfree(acpi_device_bus_id);
+ }
+ break;
+ }
+
list_del(&device->wakeup_list);
mutex_unlock(&acpi_device_lock);
OpenPOWER on IntegriCloud