Skip to content

Commit 392829e

Browse files
committed
ACPI: OSL: Rework error handling in acpi_os_execute()
Reduce the number of checks and goto labels related to error handling in acpi_os_execute() and drop the status local variable, which turns out to be redundant, from it. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 7a36b90 commit 392829e

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

drivers/acpi/osl.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,6 @@ int __init acpi_debugger_init(void)
10601060
acpi_status acpi_os_execute(acpi_execute_type type,
10611061
acpi_osd_exec_callback function, void *context)
10621062
{
1063-
acpi_status status = AE_OK;
10641063
struct acpi_os_dpc *dpc;
10651064
struct workqueue_struct *queue;
10661065
int ret;
@@ -1073,9 +1072,9 @@ acpi_status acpi_os_execute(acpi_execute_type type,
10731072
ret = acpi_debugger_create_thread(function, context);
10741073
if (ret) {
10751074
pr_err("Kernel thread creation failed\n");
1076-
status = AE_ERROR;
1075+
return AE_ERROR;
10771076
}
1078-
goto out_thread;
1077+
return AE_OK;
10791078
}
10801079

10811080
/*
@@ -1107,12 +1106,9 @@ acpi_status acpi_os_execute(acpi_execute_type type,
11071106
INIT_WORK(&dpc->work, acpi_os_execute_deferred);
11081107
} else {
11091108
pr_err("Unsupported os_execute type %d.\n", type);
1110-
status = AE_ERROR;
1109+
goto err;
11111110
}
11121111

1113-
if (ACPI_FAILURE(status))
1114-
goto err_workqueue;
1115-
11161112
/*
11171113
* On some machines, a software-initiated SMI causes corruption unless
11181114
* the SMI runs on CPU 0. An SMI can be initiated by any AML, but
@@ -1123,13 +1119,14 @@ acpi_status acpi_os_execute(acpi_execute_type type,
11231119
ret = queue_work_on(0, queue, &dpc->work);
11241120
if (!ret) {
11251121
pr_err("Unable to queue work\n");
1126-
status = AE_ERROR;
1122+
goto err;
11271123
}
1128-
err_workqueue:
1129-
if (ACPI_FAILURE(status))
1130-
kfree(dpc);
1131-
out_thread:
1132-
return status;
1124+
1125+
return AE_OK;
1126+
1127+
err:
1128+
kfree(dpc);
1129+
return AE_ERROR;
11331130
}
11341131
EXPORT_SYMBOL(acpi_os_execute);
11351132

0 commit comments

Comments
 (0)