diff options
Diffstat (limited to 'drivers/acpi/acpica/nspredef.c')
-rw-r--r-- | drivers/acpi/acpica/nspredef.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index ba1072fb0daa..7096bcda0c72 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
@@ -231,6 +231,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
231 | * Note: Package may have been newly created by call above. | 231 | * Note: Package may have been newly created by call above. |
232 | */ | 232 | */ |
233 | if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) { | 233 | if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) { |
234 | data->parent_package = *return_object_ptr; | ||
234 | status = acpi_ns_check_package(data, return_object_ptr); | 235 | status = acpi_ns_check_package(data, return_object_ptr); |
235 | if (ACPI_FAILURE(status)) { | 236 | if (ACPI_FAILURE(status)) { |
236 | goto exit; | 237 | goto exit; |
@@ -710,6 +711,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
710 | for (i = 0; i < count; i++) { | 711 | for (i = 0; i < count; i++) { |
711 | sub_package = *elements; | 712 | sub_package = *elements; |
712 | sub_elements = sub_package->package.elements; | 713 | sub_elements = sub_package->package.elements; |
714 | data->parent_package = sub_package; | ||
713 | 715 | ||
714 | /* Each sub-object must be of type Package */ | 716 | /* Each sub-object must be of type Package */ |
715 | 717 | ||
@@ -721,6 +723,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
721 | 723 | ||
722 | /* Examine the different types of expected sub-packages */ | 724 | /* Examine the different types of expected sub-packages */ |
723 | 725 | ||
726 | data->parent_package = sub_package; | ||
724 | switch (package->ret_info.type) { | 727 | switch (package->ret_info.type) { |
725 | case ACPI_PTYPE2: | 728 | case ACPI_PTYPE2: |
726 | case ACPI_PTYPE2_PKG_COUNT: | 729 | case ACPI_PTYPE2_PKG_COUNT: |
@@ -800,7 +803,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
800 | 803 | ||
801 | /* | 804 | /* |
802 | * First element is the (Integer) count of elements, including | 805 | * First element is the (Integer) count of elements, including |
803 | * the count field. | 806 | * the count field (the ACPI name is num_elements) |
804 | */ | 807 | */ |
805 | status = acpi_ns_check_object_type(data, sub_elements, | 808 | status = acpi_ns_check_object_type(data, sub_elements, |
806 | ACPI_RTYPE_INTEGER, | 809 | ACPI_RTYPE_INTEGER, |
@@ -822,6 +825,16 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
822 | expected_count = package->ret_info.count1; | 825 | expected_count = package->ret_info.count1; |
823 | goto package_too_small; | 826 | goto package_too_small; |
824 | } | 827 | } |
828 | if (expected_count == 0) { | ||
829 | /* | ||
830 | * Either the num_entries element was originally zero or it was | ||
831 | * a NULL element and repaired to an Integer of value zero. | ||
832 | * In either case, repair it by setting num_entries to be the | ||
833 | * actual size of the subpackage. | ||
834 | */ | ||
835 | expected_count = sub_package->package.count; | ||
836 | (*sub_elements)->integer.value = expected_count; | ||
837 | } | ||
825 | 838 | ||
826 | /* Check the type of each sub-package element */ | 839 | /* Check the type of each sub-package element */ |
827 | 840 | ||
@@ -945,10 +958,18 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data, | |||
945 | char type_buffer[48]; /* Room for 5 types */ | 958 | char type_buffer[48]; /* Room for 5 types */ |
946 | 959 | ||
947 | /* | 960 | /* |
948 | * If we get a NULL return_object here, it is a NULL package element, | 961 | * If we get a NULL return_object here, it is a NULL package element. |
949 | * and this is always an error. | 962 | * Since all extraneous NULL package elements were removed earlier by a |
963 | * call to acpi_ns_remove_null_elements, this is an unexpected NULL element. | ||
964 | * We will attempt to repair it. | ||
950 | */ | 965 | */ |
951 | if (!return_object) { | 966 | if (!return_object) { |
967 | status = acpi_ns_repair_null_element(data, expected_btypes, | ||
968 | package_index, | ||
969 | return_object_ptr); | ||
970 | if (ACPI_SUCCESS(status)) { | ||
971 | return (AE_OK); /* Repair was successful */ | ||
972 | } | ||
952 | goto type_error_exit; | 973 | goto type_error_exit; |
953 | } | 974 | } |
954 | 975 | ||