@@ -636,7 +636,8 @@ acpi_status
636636acpi_ps_complete_final_op (struct acpi_walk_state * walk_state ,
637637 union acpi_parse_object * op , acpi_status status )
638638{
639- acpi_status status2 ;
639+ acpi_status return_status = status ;
640+ u8 ascending = TRUE;
640641
641642 ACPI_FUNCTION_TRACE_PTR (ps_complete_final_op , walk_state );
642643
@@ -650,7 +651,7 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
650651 op ));
651652 do {
652653 if (op ) {
653- if (walk_state -> ascending_callback != NULL ) {
654+ if (ascending && walk_state -> ascending_callback != NULL ) {
654655 walk_state -> op = op ;
655656 walk_state -> op_info =
656657 acpi_ps_get_opcode_info (op -> common .
@@ -672,49 +673,26 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
672673 }
673674
674675 if (status == AE_CTRL_TERMINATE ) {
675- status = AE_OK ;
676-
677- /* Clean up */
678- do {
679- if (op ) {
680- status2 =
681- acpi_ps_complete_this_op
682- (walk_state , op );
683- if (ACPI_FAILURE
684- (status2 )) {
685- return_ACPI_STATUS
686- (status2 );
687- }
688- }
689-
690- acpi_ps_pop_scope (&
691- (walk_state ->
692- parser_state ),
693- & op ,
694- & walk_state ->
695- arg_types ,
696- & walk_state ->
697- arg_count );
698-
699- } while (op );
700-
701- return_ACPI_STATUS (status );
676+ ascending = FALSE;
677+ return_status = AE_CTRL_TERMINATE ;
702678 }
703679
704680 else if (ACPI_FAILURE (status )) {
705681
706682 /* First error is most important */
707683
708- (void )
709- acpi_ps_complete_this_op (walk_state ,
710- op );
711- return_ACPI_STATUS (status );
684+ ascending = FALSE;
685+ return_status = status ;
712686 }
713687 }
714688
715- status2 = acpi_ps_complete_this_op (walk_state , op );
716- if (ACPI_FAILURE (status2 )) {
717- return_ACPI_STATUS (status2 );
689+ status = acpi_ps_complete_this_op (walk_state , op );
690+ if (ACPI_FAILURE (status )) {
691+ ascending = FALSE;
692+ if (ACPI_SUCCESS (return_status ) ||
693+ return_status == AE_CTRL_TERMINATE ) {
694+ return_status = status ;
695+ }
718696 }
719697 }
720698
@@ -724,5 +702,5 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
724702
725703 } while (op );
726704
727- return_ACPI_STATUS (status );
705+ return_ACPI_STATUS (return_status );
728706}
0 commit comments