diff options
Diffstat (limited to 'drivers/acpi/acpica/nspredef.c')
-rw-r--r-- | drivers/acpi/acpica/nspredef.c | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index d34fa59548f7..7096bcda0c72 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2010, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -231,6 +231,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, * Note: Package may have been newly created by call above. */ if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) { + data->parent_package = *return_object_ptr; status = acpi_ns_check_package(data, return_object_ptr); if (ACPI_FAILURE(status)) { goto exit; @@ -710,6 +711,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, for (i = 0; i < count; i++) { sub_package = *elements; sub_elements = sub_package->package.elements; + data->parent_package = sub_package; /* Each sub-object must be of type Package */ @@ -721,6 +723,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, /* Examine the different types of expected sub-packages */ + data->parent_package = sub_package; switch (package->ret_info.type) { case ACPI_PTYPE2: case ACPI_PTYPE2_PKG_COUNT: @@ -800,7 +803,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, /* * First element is the (Integer) count of elements, including - * the count field. + * the count field (the ACPI name is num_elements) */ status = acpi_ns_check_object_type(data, sub_elements, ACPI_RTYPE_INTEGER, @@ -822,6 +825,16 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, expected_count = package->ret_info.count1; goto package_too_small; } + if (expected_count == 0) { + /* + * Either the num_entries element was originally zero or it was + * a NULL element and repaired to an Integer of value zero. + * In either case, repair it by setting num_entries to be the + * actual size of the subpackage. + */ + expected_count = sub_package->package.count; + (*sub_elements)->integer.value = expected_count; + } /* Check the type of each sub-package element */ @@ -945,10 +958,18 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data, char type_buffer[48]; /* Room for 5 types */ /* - * If we get a NULL return_object here, it is a NULL package element, - * and this is always an error. + * If we get a NULL return_object here, it is a NULL package element. + * Since all extraneous NULL package elements were removed earlier by a + * call to acpi_ns_remove_null_elements, this is an unexpected NULL element. + * We will attempt to repair it. */ if (!return_object) { + status = acpi_ns_repair_null_element(data, expected_btypes, + package_index, + return_object_ptr); + if (ACPI_SUCCESS(status)) { + return (AE_OK); /* Repair was successful */ + } goto type_error_exit; } @@ -1000,27 +1021,25 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data, /* Is the object one of the expected types? */ - if (!(return_btype & expected_btypes)) { + if (return_btype & expected_btypes) { - /* Type mismatch -- attempt repair of the returned object */ + /* For reference objects, check that the reference type is correct */ - status = acpi_ns_repair_object(data, expected_btypes, - package_index, - return_object_ptr); - if (ACPI_SUCCESS(status)) { - return (AE_OK); /* Repair was successful */ + if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { + status = acpi_ns_check_reference(data, return_object); } - goto type_error_exit; + + return (status); } - /* For reference objects, check that the reference type is correct */ + /* Type mismatch -- attempt repair of the returned object */ - if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { - status = acpi_ns_check_reference(data, return_object); + status = acpi_ns_repair_object(data, expected_btypes, + package_index, return_object_ptr); + if (ACPI_SUCCESS(status)) { + return (AE_OK); /* Repair was successful */ } - return (status); - type_error_exit: /* Create a string with all expected types for this predefined object */ |