]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ACPI / bus: handle ACPI hotplug schedule errors completely
authorLee, Chun-Yi <joeyli.kernel@gmail.com>
Fri, 30 Jun 2017 07:25:38 +0000 (15:25 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 4 Jul 2017 19:38:53 +0000 (21:38 +0200)
Kernel should decrements the reference count of ACPI device
when the scheduling of ACPI hotplug work failed, and evaluates
_OST to notify BIOS the failure.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/bus.c

index 784bda663d162d36d1e4bdc47ce8a6b5b595be8a..9d4fea6433f51650abc1cf83349cfc54aab21e48 100644 (file)
@@ -432,11 +432,15 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
            (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
                driver->ops.notify(adev, type);
 
-       if (hotplug_event && ACPI_SUCCESS(acpi_hotplug_schedule(adev, type)))
+       if (!hotplug_event) {
+               acpi_bus_put_acpi_device(adev);
+               return;
+       }
+
+       if (ACPI_SUCCESS(acpi_hotplug_schedule(adev, type)))
                return;
 
        acpi_bus_put_acpi_device(adev);
-       return;
 
  err:
        acpi_evaluate_ost(handle, type, ost_code, NULL);