]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ACPICA: _OSI Support: handle any errors from acpi_os_acquire_mutex()
authorJung-uk Kim <jkim@FreeBSD.org>
Fri, 12 Apr 2013 00:24:34 +0000 (00:24 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 12 Apr 2013 11:29:46 +0000 (13:29 +0200)
Check for any errors. Handles possible timeout case if
ACPI_WAIT_FOREVER is changed to be less than "forever".
Jung-uk Kim.

Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/acutils.h
drivers/acpi/acpica/utosi.c
drivers/acpi/acpica/utxface.c

index 8c25bb05bb590504c7c232e89077fba3949ddd9c..bbeb961d3a91cd353324613c26943747d66756cc 100644 (file)
@@ -421,7 +421,7 @@ acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length);
  */
 acpi_status acpi_ut_initialize_interfaces(void);
 
-void acpi_ut_interface_terminate(void);
+acpi_status acpi_ut_interface_terminate(void);
 
 acpi_status acpi_ut_install_interface(acpi_string interface_name);
 
index 36a7d361d7cb9b94b961bc6e03ccda6aa2e2ff0f..b15acebb96a1590b9555942c53a6fe883e08b306 100644 (file)
@@ -108,9 +108,14 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = {
 
 acpi_status acpi_ut_initialize_interfaces(void)
 {
+       acpi_status status;
        u32 i;
 
-       (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
+       status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
+
        acpi_gbl_supported_interfaces = acpi_default_supported_interfaces;
 
        /* Link the static list of supported interfaces */
@@ -132,20 +137,24 @@ acpi_status acpi_ut_initialize_interfaces(void)
  *
  * PARAMETERS:  None
  *
- * RETURN:      None
+ * RETURN:      Status
  *
  * DESCRIPTION: Delete all interfaces in the global list. Sets
  *              acpi_gbl_supported_interfaces to NULL.
  *
  ******************************************************************************/
 
-void acpi_ut_interface_terminate(void)
+acpi_status acpi_ut_interface_terminate(void)
 {
+       acpi_status status;
        struct acpi_interface_info *next_interface;
 
-       (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
-       next_interface = acpi_gbl_supported_interfaces;
+       status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
 
+       next_interface = acpi_gbl_supported_interfaces;
        while (next_interface) {
                acpi_gbl_supported_interfaces = next_interface->next;
 
@@ -160,6 +169,7 @@ void acpi_ut_interface_terminate(void)
        }
 
        acpi_os_release_mutex(acpi_gbl_osi_mutex);
+       return (AE_OK);
 }
 
 /*******************************************************************************
@@ -315,6 +325,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state)
        union acpi_operand_object *return_desc;
        struct acpi_interface_info *interface_info;
        acpi_interface_handler interface_handler;
+       acpi_status status;
        u32 return_value;
 
        ACPI_FUNCTION_TRACE(ut_osi_implementation);
@@ -336,7 +347,10 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state)
        /* Default return value is 0, NOT SUPPORTED */
 
        return_value = 0;
-       (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
+       status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
 
        /* Lookup the interface in the global _OSI list */
 
index 48efb446258c4114fc7ec626ac6a144bffad798a..6505774f223e372239a0ee5fadfc00e4aaaf0446 100644 (file)
@@ -287,7 +287,10 @@ acpi_status acpi_install_interface(acpi_string interface_name)
                return (AE_BAD_PARAMETER);
        }
 
-       (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
+       status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
 
        /* Check if the interface name is already in the global list */
 
@@ -336,7 +339,10 @@ acpi_status acpi_remove_interface(acpi_string interface_name)
                return (AE_BAD_PARAMETER);
        }
 
-       (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
+       status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
 
        status = acpi_ut_remove_interface(interface_name);
 
@@ -362,9 +368,12 @@ ACPI_EXPORT_SYMBOL(acpi_remove_interface)
  ****************************************************************************/
 acpi_status acpi_install_interface_handler(acpi_interface_handler handler)
 {
-       acpi_status status = AE_OK;
+       acpi_status status;
 
-       (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
+       status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
 
        if (handler && acpi_gbl_interface_handler) {
                status = AE_ALREADY_EXISTS;