summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-11-29 14:46:51 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-12-06 21:14:33 +0100
commit392829ede37f36efa2e0f034631594786a9c8139 (patch)
treebc99a72c3391d05802c90a36e8c93b856d8c8720
parent7a36b901a6eb0e9945341db71ed3c45c7721cfa9 (diff)
downloadlinux-stable-392829ede37f36efa2e0f034631594786a9c8139.tar.gz
linux-stable-392829ede37f36efa2e0f034631594786a9c8139.tar.bz2
linux-stable-392829ede37f36efa2e0f034631594786a9c8139.zip
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>
-rw-r--r--drivers/acpi/osl.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index d56dda795118..603057f6c63e 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1060,7 +1060,6 @@ int __init acpi_debugger_init(void)
acpi_status acpi_os_execute(acpi_execute_type type,
acpi_osd_exec_callback function, void *context)
{
- acpi_status status = AE_OK;
struct acpi_os_dpc *dpc;
struct workqueue_struct *queue;
int ret;
@@ -1073,9 +1072,9 @@ acpi_status acpi_os_execute(acpi_execute_type type,
ret = acpi_debugger_create_thread(function, context);
if (ret) {
pr_err("Kernel thread creation failed\n");
- status = AE_ERROR;
+ return AE_ERROR;
}
- goto out_thread;
+ return AE_OK;
}
/*
@@ -1107,12 +1106,9 @@ acpi_status acpi_os_execute(acpi_execute_type type,
INIT_WORK(&dpc->work, acpi_os_execute_deferred);
} else {
pr_err("Unsupported os_execute type %d.\n", type);
- status = AE_ERROR;
+ goto err;
}
- if (ACPI_FAILURE(status))
- goto err_workqueue;
-
/*
* On some machines, a software-initiated SMI causes corruption unless
* 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,
ret = queue_work_on(0, queue, &dpc->work);
if (!ret) {
pr_err("Unable to queue work\n");
- status = AE_ERROR;
+ goto err;
}
-err_workqueue:
- if (ACPI_FAILURE(status))
- kfree(dpc);
-out_thread:
- return status;
+
+ return AE_OK;
+
+err:
+ kfree(dpc);
+ return AE_ERROR;
}
EXPORT_SYMBOL(acpi_os_execute);