diff options
author | Bob Moore <robert.moore@intel.com> | 2008-04-10 19:06:37 +0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-22 14:29:22 -0400 |
commit | f02e9fa1ceee045f7d5c53d475032815752a2510 (patch) | |
tree | 52da78bd3ef6442418ad2dae6fa55aab964dc6b4 /drivers/acpi/executer/exmutex.c | |
parent | a4df451a1055d97726ab890249bc3f941906fa75 (diff) |
ACPICA: Misc fixes for recent global lock code update
Fixes as a result of running full validation test suite.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/executer/exmutex.c')
-rw-r--r-- | drivers/acpi/executer/exmutex.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index 32f24a8fba57..b8d035c00b61 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c @@ -156,6 +156,10 @@ acpi_ex_acquire_mutex_object(u16 timeout, ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex_object, obj_desc); + if (!obj_desc) { + return_ACPI_STATUS(AE_BAD_PARAMETER); + } + /* Support for multiple acquires by the owning thread */ if (obj_desc->mutex.thread_id == thread_id) { @@ -290,6 +294,10 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) ACPI_FUNCTION_TRACE(ex_release_mutex_object); + if (obj_desc->mutex.acquisition_depth == 0) { + return (AE_NOT_ACQUIRED); + } + /* Match multiple Acquires with multiple Releases */ obj_desc->mutex.acquisition_depth--; @@ -387,17 +395,22 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, */ if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { ACPI_ERROR((AE_INFO, - "Cannot release Mutex [%4.4s], incorrect SyncLevel", - acpi_ut_get_node_name(obj_desc->mutex.node))); + "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", + acpi_ut_get_node_name(obj_desc->mutex.node), + obj_desc->mutex.sync_level, + walk_state->thread->current_sync_level)); return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } status = acpi_ex_release_mutex_object(obj_desc); - /* Restore the original sync_level */ + if (obj_desc->mutex.acquisition_depth == 0) { + + /* Restore the original sync_level */ - walk_state->thread->current_sync_level = - obj_desc->mutex.original_sync_level; + walk_state->thread->current_sync_level = + obj_desc->mutex.original_sync_level; + } return_ACPI_STATUS(status); } |