Merge tag 'pci-v4.13-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaa...
[sfrench/cifs-2.6.git] / drivers / acpi / bus.c
index 5a6fbe0fcaf2b82db279c40bd031abac2b4b6125..af74b420ec833997b710c1cbd628da7c6bfa34c6 100644 (file)
@@ -409,11 +409,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);