diff options
Diffstat (limited to 'drivers/acpi/dispatcher/dsmethod.c')
-rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index c9d9a6c45ae3..1b90813cbde1 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -77,7 +77,6 @@ acpi_ds_parse_method ( | |||
77 | union acpi_operand_object *obj_desc; | 77 | union acpi_operand_object *obj_desc; |
78 | union acpi_parse_object *op; | 78 | union acpi_parse_object *op; |
79 | struct acpi_namespace_node *node; | 79 | struct acpi_namespace_node *node; |
80 | acpi_owner_id owner_id; | ||
81 | struct acpi_walk_state *walk_state; | 80 | struct acpi_walk_state *walk_state; |
82 | 81 | ||
83 | 82 | ||
@@ -132,15 +131,18 @@ acpi_ds_parse_method ( | |||
132 | * objects (such as Operation Regions) can be created during the | 131 | * objects (such as Operation Regions) can be created during the |
133 | * first pass parse. | 132 | * first pass parse. |
134 | */ | 133 | */ |
135 | owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD); | 134 | status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); |
136 | obj_desc->method.owning_id = owner_id; | 135 | if (ACPI_FAILURE (status)) { |
136 | goto cleanup; | ||
137 | } | ||
137 | 138 | ||
138 | /* Create and initialize a new walk state */ | 139 | /* Create and initialize a new walk state */ |
139 | 140 | ||
140 | walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL); | 141 | walk_state = acpi_ds_create_walk_state ( |
142 | obj_desc->method.owner_id, NULL, NULL, NULL); | ||
141 | if (!walk_state) { | 143 | if (!walk_state) { |
142 | status = AE_NO_MEMORY; | 144 | status = AE_NO_MEMORY; |
143 | goto cleanup; | 145 | goto cleanup2; |
144 | } | 146 | } |
145 | 147 | ||
146 | status = acpi_ds_init_aml_walk (walk_state, op, node, | 148 | status = acpi_ds_init_aml_walk (walk_state, op, node, |
@@ -148,7 +150,7 @@ acpi_ds_parse_method ( | |||
148 | obj_desc->method.aml_length, NULL, 1); | 150 | obj_desc->method.aml_length, NULL, 1); |
149 | if (ACPI_FAILURE (status)) { | 151 | if (ACPI_FAILURE (status)) { |
150 | acpi_ds_delete_walk_state (walk_state); | 152 | acpi_ds_delete_walk_state (walk_state); |
151 | goto cleanup; | 153 | goto cleanup2; |
152 | } | 154 | } |
153 | 155 | ||
154 | /* | 156 | /* |
@@ -162,13 +164,16 @@ acpi_ds_parse_method ( | |||
162 | */ | 164 | */ |
163 | status = acpi_ps_parse_aml (walk_state); | 165 | status = acpi_ps_parse_aml (walk_state); |
164 | if (ACPI_FAILURE (status)) { | 166 | if (ACPI_FAILURE (status)) { |
165 | goto cleanup; | 167 | goto cleanup2; |
166 | } | 168 | } |
167 | 169 | ||
168 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | 170 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
169 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", | 171 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", |
170 | acpi_ut_get_node_name (obj_handle), obj_handle, op)); | 172 | acpi_ut_get_node_name (obj_handle), obj_handle, op)); |
171 | 173 | ||
174 | cleanup2: | ||
175 | (void) acpi_ut_release_owner_id (obj_desc->method.owner_id); | ||
176 | |||
172 | cleanup: | 177 | cleanup: |
173 | acpi_ps_delete_parse_tree (op); | 178 | acpi_ps_delete_parse_tree (op); |
174 | return_ACPI_STATUS (status); | 179 | return_ACPI_STATUS (status); |
@@ -265,7 +270,7 @@ acpi_ds_call_control_method ( | |||
265 | { | 270 | { |
266 | acpi_status status; | 271 | acpi_status status; |
267 | struct acpi_namespace_node *method_node; | 272 | struct acpi_namespace_node *method_node; |
268 | struct acpi_walk_state *next_walk_state; | 273 | struct acpi_walk_state *next_walk_state = NULL; |
269 | union acpi_operand_object *obj_desc; | 274 | union acpi_operand_object *obj_desc; |
270 | struct acpi_parameter_info info; | 275 | struct acpi_parameter_info info; |
271 | u32 i; | 276 | u32 i; |
@@ -289,20 +294,23 @@ acpi_ds_call_control_method ( | |||
289 | return_ACPI_STATUS (AE_NULL_OBJECT); | 294 | return_ACPI_STATUS (AE_NULL_OBJECT); |
290 | } | 295 | } |
291 | 296 | ||
292 | obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD); | 297 | status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); |
298 | if (ACPI_FAILURE (status)) { | ||
299 | return_ACPI_STATUS (status); | ||
300 | } | ||
293 | 301 | ||
294 | /* Init for new method, wait on concurrency semaphore */ | 302 | /* Init for new method, wait on concurrency semaphore */ |
295 | 303 | ||
296 | status = acpi_ds_begin_method_execution (method_node, obj_desc, | 304 | status = acpi_ds_begin_method_execution (method_node, obj_desc, |
297 | this_walk_state->method_node); | 305 | this_walk_state->method_node); |
298 | if (ACPI_FAILURE (status)) { | 306 | if (ACPI_FAILURE (status)) { |
299 | return_ACPI_STATUS (status); | 307 | goto cleanup; |
300 | } | 308 | } |
301 | 309 | ||
302 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { | 310 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { |
303 | /* 1) Parse: Create a new walk state for the preempting walk */ | 311 | /* 1) Parse: Create a new walk state for the preempting walk */ |
304 | 312 | ||
305 | next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, | 313 | next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id, |
306 | op, obj_desc, NULL); | 314 | op, obj_desc, NULL); |
307 | if (!next_walk_state) { | 315 | if (!next_walk_state) { |
308 | return_ACPI_STATUS (AE_NO_MEMORY); | 316 | return_ACPI_STATUS (AE_NO_MEMORY); |
@@ -332,7 +340,7 @@ acpi_ds_call_control_method ( | |||
332 | 340 | ||
333 | /* 2) Execute: Create a new state for the preempting walk */ | 341 | /* 2) Execute: Create a new state for the preempting walk */ |
334 | 342 | ||
335 | next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, | 343 | next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id, |
336 | NULL, obj_desc, thread); | 344 | NULL, obj_desc, thread); |
337 | if (!next_walk_state) { | 345 | if (!next_walk_state) { |
338 | status = AE_NO_MEMORY; | 346 | status = AE_NO_MEMORY; |
@@ -383,6 +391,7 @@ acpi_ds_call_control_method ( | |||
383 | /* On error, we must delete the new walk state */ | 391 | /* On error, we must delete the new walk state */ |
384 | 392 | ||
385 | cleanup: | 393 | cleanup: |
394 | (void) acpi_ut_release_owner_id (obj_desc->method.owner_id); | ||
386 | if (next_walk_state && (next_walk_state->method_desc)) { | 395 | if (next_walk_state && (next_walk_state->method_desc)) { |
387 | /* Decrement the thread count on the method parse tree */ | 396 | /* Decrement the thread count on the method parse tree */ |
388 | 397 | ||
@@ -584,7 +593,7 @@ acpi_ds_terminate_control_method ( | |||
584 | * Delete any namespace entries created anywhere else within | 593 | * Delete any namespace entries created anywhere else within |
585 | * the namespace | 594 | * the namespace |
586 | */ | 595 | */ |
587 | acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id); | 596 | acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id); |
588 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 597 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
589 | if (ACPI_FAILURE (status)) { | 598 | if (ACPI_FAILURE (status)) { |
590 | return_ACPI_STATUS (status); | 599 | return_ACPI_STATUS (status); |