Commit 7dbec553 authored by Bob Moore's avatar Bob Moore Committed by Rafael J. Wysocki

ACPICA: Refactor evaluate_object to reduce nesting

ACPICA commit 599e9159f53565e4a3f3e67f6a03f81fcb10a4cf

Original patch from hanjun.guo@linaro.org

ACPICA BZ 1072.

Link: https://github.com/acpica/acpica/commit/599e9159
Link: https://bugs.acpica.org/show_bug.cgi?id=1072Original-by: default avatarHanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent f5c1e1c5
......@@ -280,13 +280,12 @@ acpi_evaluate_object(acpi_handle handle,
info->parameters[info->param_count] = NULL;
}
#if 0
#ifdef _FUTURE_FEATURE
/*
* Begin incoming argument count analysis. Check for too few args
* and too many args.
*/
switch (acpi_ns_get_type(info->node)) {
case ACPI_TYPE_METHOD:
......@@ -370,10 +369,15 @@ acpi_evaluate_object(acpi_handle handle,
* If we are expecting a return value, and all went well above,
* copy the return value to an external object.
*/
if (return_buffer) {
if (!return_buffer) {
goto cleanup_return_object;
}
if (!info->return_object) {
return_buffer->length = 0;
} else {
goto cleanup;
}
if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) ==
ACPI_DESC_TYPE_NAMED) {
/*
......@@ -389,7 +393,9 @@ acpi_evaluate_object(acpi_handle handle,
return_buffer->length = 0;
}
if (ACPI_SUCCESS(status)) {
if (ACPI_FAILURE(status)) {
goto cleanup_return_object;
}
/* Dereference Index and ref_of references */
......@@ -397,16 +403,13 @@ acpi_evaluate_object(acpi_handle handle,
/* Get the size of the returned object */
status =
acpi_ut_get_object_size(info->return_object,
status = acpi_ut_get_object_size(info->return_object,
&buffer_space_needed);
if (ACPI_SUCCESS(status)) {
/* Validate/Allocate/Clear caller buffer */
status =
acpi_ut_initialize_buffer
(return_buffer,
status = acpi_ut_initialize_buffer(return_buffer,
buffer_space_needed);
if (ACPI_FAILURE(status)) {
/*
......@@ -415,22 +418,18 @@ acpi_evaluate_object(acpi_handle handle,
*/
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Needed buffer size %X, %s\n",
(u32)
buffer_space_needed,
acpi_format_exception
(status)));
(u32)buffer_space_needed,
acpi_format_exception(status)));
} else {
/* We have enough space for the object, build it */
status =
acpi_ut_copy_iobject_to_eobject
(info->return_object,
acpi_ut_copy_iobject_to_eobject(info->return_object,
return_buffer);
}
}
}
}
}
cleanup_return_object:
if (info->return_object) {
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment