@@ -2250,27 +2250,31 @@ int __init acpi_scan_init(void)
*/
result = acpi_bus_scan(ACPI_ROOT_OBJECT);
if (result)
- goto out;
+ goto cleanup;
result = acpi_bus_get_device(ACPI_ROOT_OBJECT, &acpi_root);
if (result)
- goto out;
+ goto cleanup;
/* Fixed feature devices do not exist on HW-reduced platform */
if (!acpi_gbl_reduced_hardware) {
result = acpi_bus_scan_fixed();
- if (result) {
- acpi_detach_data(acpi_root->handle,
- acpi_scan_drop_device);
- acpi_device_del(acpi_root);
- put_device(&acpi_root->dev);
- goto out;
- }
+ if (result)
+ goto cleanup;
}
acpi_scan_initialized = true;
- out:
+ mutex_unlock(&acpi_scan_lock);
+ return 0;
+
+cleanup:
+ if (acpi_root) {
+ acpi_detach_data(acpi_root->handle, acpi_scan_drop_device);
+ acpi_device_del(acpi_root);
+ put_device(&acpi_root->dev);
+ }
+
mutex_unlock(&acpi_scan_lock);
return result;
}
Add a separate cleanup exit-path to acpi_scan_init(). This is a preparation patch for splitting the scanning of the root into 2 steps, deferring the addition of some devices which need access to OpRegions of other devices during scanning to the second step. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/acpi/scan.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)