Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+10 -13
+10 -13
drivers/acpi/osl.c
··· 1060 1060 acpi_status acpi_os_execute(acpi_execute_type type, 1061 1061 acpi_osd_exec_callback function, void *context) 1062 1062 { 1063 - acpi_status status = AE_OK; 1064 1063 struct acpi_os_dpc *dpc; 1065 1064 struct workqueue_struct *queue; 1066 1065 int ret; ··· 1072 1073 ret = acpi_debugger_create_thread(function, context); 1073 1074 if (ret) { 1074 1075 pr_err("Kernel thread creation failed\n"); 1075 - status = AE_ERROR; 1076 + return AE_ERROR; 1076 1077 } 1077 - goto out_thread; 1078 + return AE_OK; 1078 1079 } 1079 1080 1080 1081 /* ··· 1106 1107 INIT_WORK(&dpc->work, acpi_os_execute_deferred); 1107 1108 } else { 1108 1109 pr_err("Unsupported os_execute type %d.\n", type); 1109 - status = AE_ERROR; 1110 + goto err; 1110 1111 } 1111 - 1112 - if (ACPI_FAILURE(status)) 1113 - goto err_workqueue; 1114 1112 1115 1113 /* 1116 1114 * On some machines, a software-initiated SMI causes corruption unless ··· 1119 1123 ret = queue_work_on(0, queue, &dpc->work); 1120 1124 if (!ret) { 1121 1125 pr_err("Unable to queue work\n"); 1122 - status = AE_ERROR; 1126 + goto err; 1123 1127 } 1124 - err_workqueue: 1125 - if (ACPI_FAILURE(status)) 1126 - kfree(dpc); 1127 - out_thread: 1128 - return status; 1128 + 1129 + return AE_OK; 1130 + 1131 + err: 1132 + kfree(dpc); 1133 + return AE_ERROR; 1129 1134 } 1130 1135 EXPORT_SYMBOL(acpi_os_execute); 1131 1136