aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/parser/psparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/parser/psparse.c')
-rw-r--r--drivers/acpi/parser/psparse.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c
index 15e1702e48d6..68e932f215ea 100644
--- a/drivers/acpi/parser/psparse.c
+++ b/drivers/acpi/parser/psparse.c
@@ -137,6 +137,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
137 union acpi_parse_object *next; 137 union acpi_parse_object *next;
138 const struct acpi_opcode_info *parent_info; 138 const struct acpi_opcode_info *parent_info;
139 union acpi_parse_object *replacement_op = NULL; 139 union acpi_parse_object *replacement_op = NULL;
140 acpi_status status = AE_OK;
140 141
141 ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op); 142 ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op);
142 143
@@ -186,7 +187,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
186 replacement_op = 187 replacement_op =
187 acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); 188 acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
188 if (!replacement_op) { 189 if (!replacement_op) {
189 goto allocate_error; 190 status = AE_NO_MEMORY;
190 } 191 }
191 break; 192 break;
192 193
@@ -211,7 +212,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
211 replacement_op = 212 replacement_op =
212 acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); 213 acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
213 if (!replacement_op) { 214 if (!replacement_op) {
214 goto allocate_error; 215 status = AE_NO_MEMORY;
215 } 216 }
216 } else 217 } else
217 if ((op->common.parent->common.aml_opcode == 218 if ((op->common.parent->common.aml_opcode ==
@@ -226,13 +227,13 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
226 acpi_ps_alloc_op(op->common. 227 acpi_ps_alloc_op(op->common.
227 aml_opcode); 228 aml_opcode);
228 if (!replacement_op) { 229 if (!replacement_op) {
229 goto allocate_error; 230 status = AE_NO_MEMORY;
231 } else {
232 replacement_op->named.data =
233 op->named.data;
234 replacement_op->named.length =
235 op->named.length;
230 } 236 }
231
232 replacement_op->named.data =
233 op->named.data;
234 replacement_op->named.length =
235 op->named.length;
236 } 237 }
237 } 238 }
238 break; 239 break;
@@ -242,7 +243,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
242 replacement_op = 243 replacement_op =
243 acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); 244 acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
244 if (!replacement_op) { 245 if (!replacement_op) {
245 goto allocate_error; 246 status = AE_NO_MEMORY;
246 } 247 }
247 } 248 }
248 249
@@ -302,14 +303,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
302 /* Now we can actually delete the subtree rooted at Op */ 303 /* Now we can actually delete the subtree rooted at Op */
303 304
304 acpi_ps_delete_parse_tree(op); 305 acpi_ps_delete_parse_tree(op);
305 return_ACPI_STATUS(AE_OK); 306 return_ACPI_STATUS(status);
306
307 allocate_error:
308
309 /* Always delete the subtree, even on error */
310
311 acpi_ps_delete_parse_tree(op);
312 return_ACPI_STATUS(AE_NO_MEMORY);
313} 307}
314 308
315/******************************************************************************* 309/*******************************************************************************
@@ -641,10 +635,12 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
641 ACPI_WALK_METHOD_RESTART; 635 ACPI_WALK_METHOD_RESTART;
642 } 636 }
643 } else { 637 } else {
644 /* On error, delete any return object */ 638 /* On error, delete any return object or implicit return */
645 639
646 acpi_ut_remove_reference(previous_walk_state-> 640 acpi_ut_remove_reference(previous_walk_state->
647 return_desc); 641 return_desc);
642 acpi_ds_clear_implicit_return
643 (previous_walk_state);
648 } 644 }
649 } 645 }
650 646