提交 ca9dc8d4 编写于 作者: L Lukas Wunner 提交者: Rafael J. Wysocki

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: NLukas Wunner <lukas@wunner.de>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 e399037e
...@@ -471,10 +471,24 @@ static void acpi_device_release(struct device *dev) ...@@ -471,10 +471,24 @@ static void acpi_device_release(struct device *dev)
static void acpi_device_del(struct acpi_device *device) static void acpi_device_del(struct acpi_device *device)
{ {
struct acpi_device_bus_id *acpi_device_bus_id;
mutex_lock(&acpi_device_lock); mutex_lock(&acpi_device_lock);
if (device->parent) if (device->parent)
list_del(&device->node); 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); list_del(&device->wakeup_list);
mutex_unlock(&acpi_device_lock); mutex_unlock(&acpi_device_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册