aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/utobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/utobject.c')
-rw-r--r--drivers/acpi/acpica/utobject.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index aa61f66ee861..13e045025c33 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -180,7 +180,7 @@ union acpi_operand_object *acpi_ut_create_package_object(u32 count)
180 package_elements = ACPI_ALLOCATE_ZEROED(((acpi_size) count + 180 package_elements = ACPI_ALLOCATE_ZEROED(((acpi_size) count +
181 1) * sizeof(void *)); 181 1) * sizeof(void *));
182 if (!package_elements) { 182 if (!package_elements) {
183 acpi_ut_remove_reference(package_desc); 183 ACPI_FREE(package_desc);
184 return_PTR(NULL); 184 return_PTR(NULL);
185 } 185 }
186 186
@@ -396,7 +396,6 @@ void *acpi_ut_allocate_object_desc_dbg(const char *module_name,
396 396
397 /* Mark the descriptor type */ 397 /* Mark the descriptor type */
398 398
399 memset(object, 0, sizeof(union acpi_operand_object));
400 ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); 399 ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND);
401 400
402 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p Size %X\n", 401 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
@@ -461,25 +460,28 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
461 460
462 ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object); 461 ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object);
463 462
463 /* Start with the length of the (external) Acpi object */
464
465 length = sizeof(union acpi_object);
466
467 /* A NULL object is allowed, can be a legal uninitialized package element */
468
469 if (!internal_object) {
464 /* 470 /*
465 * Handle a null object (Could be a uninitialized package 471 * Object is NULL, just return the length of union acpi_object
466 * element -- which is legal) 472 * (A NULL union acpi_object is an object of all zeroes.)
467 */ 473 */
468 if (!internal_object) { 474 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
469 *obj_length = sizeof(union acpi_object);
470 return_ACPI_STATUS(AE_OK); 475 return_ACPI_STATUS(AE_OK);
471 } 476 }
472 477
473 /* Start with the length of the Acpi object */ 478 /* A Namespace Node should never appear here */
474
475 length = sizeof(union acpi_object);
476 479
477 if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { 480 if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
478 481
479 /* Object is a named object (reference), just return the length */ 482 /* A namespace node should never get here */
480 483
481 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); 484 return_ACPI_STATUS(AE_AML_INTERNAL);
482 return_ACPI_STATUS(status);
483 } 485 }
484 486
485 /* 487 /*