diff options
Diffstat (limited to 'drivers/acpi/acpica/nspredef.c')
-rw-r--r-- | drivers/acpi/acpica/nspredef.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index f8427afeebdf..b05f42903c86 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
@@ -232,6 +232,12 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
232 | status = acpi_ns_check_package(data, return_object_ptr); | 232 | status = acpi_ns_check_package(data, return_object_ptr); |
233 | } | 233 | } |
234 | 234 | ||
235 | /* | ||
236 | * Perform additional, more complicated repairs on a per-name | ||
237 | * basis. | ||
238 | */ | ||
239 | status = acpi_ns_complex_repairs(data, node, status, return_object_ptr); | ||
240 | |||
235 | check_validation_status: | 241 | check_validation_status: |
236 | /* | 242 | /* |
237 | * If the object validation failed or if we successfully repaired one | 243 | * If the object validation failed or if we successfully repaired one |
@@ -601,7 +607,8 @@ acpi_ns_check_package(struct acpi_predefined_data *data, | |||
601 | * there is only one entry). We may be able to repair this by | 607 | * there is only one entry). We may be able to repair this by |
602 | * wrapping the returned Package with a new outer Package. | 608 | * wrapping the returned Package with a new outer Package. |
603 | */ | 609 | */ |
604 | if ((*elements)->common.type != ACPI_TYPE_PACKAGE) { | 610 | if (*elements |
611 | && ((*elements)->common.type != ACPI_TYPE_PACKAGE)) { | ||
605 | 612 | ||
606 | /* Create the new outer package and populate it */ | 613 | /* Create the new outer package and populate it */ |
607 | 614 | ||
@@ -673,6 +680,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
673 | union acpi_operand_object *sub_package; | 680 | union acpi_operand_object *sub_package; |
674 | union acpi_operand_object **sub_elements; | 681 | union acpi_operand_object **sub_elements; |
675 | acpi_status status; | 682 | acpi_status status; |
683 | u8 non_trailing_null = FALSE; | ||
676 | u32 expected_count; | 684 | u32 expected_count; |
677 | u32 i; | 685 | u32 i; |
678 | u32 j; | 686 | u32 j; |
@@ -680,6 +688,45 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
680 | /* Validate each sub-Package in the parent Package */ | 688 | /* Validate each sub-Package in the parent Package */ |
681 | 689 | ||
682 | for (i = 0; i < count; i++) { | 690 | for (i = 0; i < count; i++) { |
691 | /* | ||
692 | * Handling for NULL package elements. For now, we will simply allow | ||
693 | * a parent package with trailing NULL elements. This can happen if | ||
694 | * the package was defined to be longer than the initializer list. | ||
695 | * This is legal as per the ACPI specification. It is often used | ||
696 | * to allow for dynamic initialization of a Package. | ||
697 | * | ||
698 | * A future enhancement may be to simply truncate the package to | ||
699 | * remove the trailing NULL elements. | ||
700 | */ | ||
701 | if (!(*elements)) { | ||
702 | if (!non_trailing_null) { | ||
703 | |||
704 | /* Ensure the remaining elements are all NULL */ | ||
705 | |||
706 | for (j = 1; j < (count - i + 1); j++) { | ||
707 | if (elements[j]) { | ||
708 | non_trailing_null = TRUE; | ||
709 | } | ||
710 | } | ||
711 | |||
712 | if (!non_trailing_null) { | ||
713 | |||
714 | /* Ignore the trailing NULL elements */ | ||
715 | |||
716 | return (AE_OK); | ||
717 | } | ||
718 | } | ||
719 | |||
720 | /* There are trailing non-null elements, issue warning */ | ||
721 | |||
722 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, | ||
723 | data->node_flags, | ||
724 | "Found NULL element at package index %u", | ||
725 | i)); | ||
726 | elements++; | ||
727 | continue; | ||
728 | } | ||
729 | |||
683 | sub_package = *elements; | 730 | sub_package = *elements; |
684 | sub_elements = sub_package->package.elements; | 731 | sub_elements = sub_package->package.elements; |
685 | 732 | ||