@@ -402,7 +402,8 @@ void
acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
struct acpi_walk_state *walk_state)
{
- s32 i;
+ u32 i;
+ s32 stack_top;
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete);
@@ -411,7 +412,11 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
return;
}
- for (i = (s32)pop_count - 1; i >= 0; i--) {
+ /* Calculate curruent top of the stack */
+
+ stack_top = (s32)walk_state->num_operands + walk_state->operand_index - 1;
+
+ for (i = 0; i < pop_count ; i++) {
if (walk_state->num_operands == 0) {
return;
}
@@ -419,11 +424,12 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
/* Pop the stack and delete an object if present in this stack entry */
walk_state->num_operands--;
- obj_desc = walk_state->operands[i];
+ obj_desc = walk_state->operands[stack_top];
if (obj_desc) {
- acpi_ut_remove_reference(walk_state->operands[i]);
- walk_state->operands[i] = NULL;
+ acpi_ut_remove_reference(walk_state->operands[stack_top]);
+ walk_state->operands[stack_top] = NULL;
}
+ stack_top--;
}
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",