aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exconfig.c
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-05-26 00:00:00 -0400
committerLen Brown <len.brown@intel.com>2005-07-13 16:46:34 -0400
commit88ac00f5a841dcfc5c682000f4a6add0add8caac (patch)
tree80dcff8323c6c79e8706f42eb4b7c3884bc03152 /drivers/acpi/executer/exconfig.c
parent6f42ccf2fc50ecee8ea170040627f268430c1648 (diff)
ACPICA 20050526 from Bob Moore <robert.moore@intel.com>
Implemented support to execute Type 1 and Type 2 AML opcodes appearing at the module level (not within a control method.) These opcodes are executed exactly once at the time the table is loaded. This type of code was legal up until the release of ACPI 2.0B (2002) and is now supported within ACPI CA in order to provide backwards compatibility with earlier BIOS implementations. This eliminates the "Encountered executable code at module level" warning that was previously generated upon detection of such code. Fixed a problem in the interpreter where an AE_NOT_FOUND exception could inadvertently be generated during the lookup of namespace objects in the second pass parse of ACPI tables and control methods. It appears that this problem could occur during the resolution of forward references to namespace objects. Added the ACPI_MUTEX_DEBUG #ifdef to the acpi_ut_release_mutex function, corresponding to the same the deadlock detection debug code to be compiled out in the normal case, improving mutex performance (and overall subsystem performance) considerably. As suggested by Alexey Starikovskiy. Implemented a handful of miscellaneous fixes for possible memory leaks on error conditions and error handling control paths. These fixes were suggested by FreeBSD and the Coverity Prevent source code analysis tool. Added a check for a null RSDT pointer in acpi_get_firmware_table (tbxfroot.c) to prevent a fault in this error case. Signed-off-by Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/executer/exconfig.c')
-rw-r--r--drivers/acpi/executer/exconfig.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index 734b2f24af48..8bfa6effaa0c 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -376,16 +376,22 @@ acpi_ex_load_op (
376 */ 376 */
377 status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc); 377 status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
378 if (ACPI_FAILURE (status)) { 378 if (ACPI_FAILURE (status)) {
379 goto cleanup; 379 return_ACPI_STATUS (status);
380 } 380 }
381 381
382 table_ptr = ACPI_CAST_PTR (struct acpi_table_header, 382 table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
383 buffer_desc->buffer.pointer); 383 buffer_desc->buffer.pointer);
384 384
385 /* Sanity check the table length */ 385 /* All done with the buffer_desc, delete it */
386
387 buffer_desc->buffer.pointer = NULL;
388 acpi_ut_remove_reference (buffer_desc);
389
390 /* Sanity check the table length */
386 391
387 if (table_ptr->length < sizeof (struct acpi_table_header)) { 392 if (table_ptr->length < sizeof (struct acpi_table_header)) {
388 return_ACPI_STATUS (AE_BAD_HEADER); 393 status = AE_BAD_HEADER;
394 goto cleanup;
389 } 395 }
390 break; 396 break;
391 397
@@ -413,7 +419,9 @@ acpi_ex_load_op (
413 419
414 status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle); 420 status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle);
415 if (ACPI_FAILURE (status)) { 421 if (ACPI_FAILURE (status)) {
416 goto cleanup; 422 /* On error, table_ptr was deallocated above */
423
424 return_ACPI_STATUS (status);
417 } 425 }
418 426
419 /* Store the ddb_handle into the Target operand */ 427 /* Store the ddb_handle into the Target operand */
@@ -421,17 +429,14 @@ acpi_ex_load_op (
421 status = acpi_ex_store (ddb_handle, target, walk_state); 429 status = acpi_ex_store (ddb_handle, target, walk_state);
422 if (ACPI_FAILURE (status)) { 430 if (ACPI_FAILURE (status)) {
423 (void) acpi_ex_unload_table (ddb_handle); 431 (void) acpi_ex_unload_table (ddb_handle);
424 }
425 432
426 return_ACPI_STATUS (status); 433 /* table_ptr was deallocated above */
427 434
435 return_ACPI_STATUS (status);
436 }
428 437
429cleanup: 438cleanup:
430 439 if (ACPI_FAILURE (status)) {
431 if (buffer_desc) {
432 acpi_ut_remove_reference (buffer_desc);
433 }
434 else {
435 ACPI_MEM_FREE (table_ptr); 440 ACPI_MEM_FREE (table_ptr);
436 } 441 }
437 return_ACPI_STATUS (status); 442 return_ACPI_STATUS (status);