Subject: Print error message if remove/install notify handler fails Messages have been removed from the calling functions... signed-off-by: Thomas Renninger evxface.c | 47 ++++++++++++++++++++++++++++------------------- 1 files changed, 28 insertions(+), 19 deletions(-) Index: linux-2.6.15/drivers/acpi/events/evxface.c =================================================================== --- linux-2.6.15.orig/drivers/acpi/events/evxface.c +++ linux-2.6.15/drivers/acpi/events/evxface.c @@ -415,12 +415,13 @@ acpi_remove_notify_handler(acpi_handle d if ((!device) || (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + status = AE_BAD_PARAMETER; + goto exit; } status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Convert and validate the device handle */ @@ -428,7 +429,7 @@ acpi_remove_notify_handler(acpi_handle d node = acpi_ns_map_handle_to_node(device); if (!node) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Root Object */ @@ -442,7 +443,7 @@ acpi_remove_notify_handler(acpi_handle d ((handler_type & ACPI_DEVICE_NOTIFY) && !acpi_gbl_device_notify.handler)) { status = AE_NOT_EXIST; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -451,7 +452,7 @@ acpi_remove_notify_handler(acpi_handle d acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } if (handler_type & ACPI_SYSTEM_NOTIFY) { @@ -474,7 +475,7 @@ acpi_remove_notify_handler(acpi_handle d if (!acpi_ev_is_notify_object(node)) { status = AE_TYPE; - goto unlock_and_exit; + goto unlock; } /* Check for an existing internal object */ @@ -482,7 +483,7 @@ acpi_remove_notify_handler(acpi_handle d obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { status = AE_NOT_EXIST; - goto unlock_and_exit; + goto unlock; } /* Object exists - make sure there's an existing handler */ @@ -492,7 +493,7 @@ acpi_remove_notify_handler(acpi_handle d if ((!notify_obj) || (notify_obj->notify.handler != handler)) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -500,7 +501,7 @@ acpi_remove_notify_handler(acpi_handle d acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Remove the handler */ @@ -513,7 +514,7 @@ acpi_remove_notify_handler(acpi_handle d if ((!notify_obj) || (notify_obj->notify.handler != handler)) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -521,7 +522,7 @@ acpi_remove_notify_handler(acpi_handle d acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Remove the handler */ @@ -530,8 +531,11 @@ acpi_remove_notify_handler(acpi_handle d } } - unlock_and_exit: +unlock: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); +exit: + if (ACPI_FAILURE(status)) + ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler")); return_ACPI_STATUS(status); } @@ -570,12 +574,13 @@ acpi_install_gpe_handler(acpi_handle gpe /* Parameter validation */ if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + status = AE_BAD_PARAMETER; + goto exit; } status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Ensure that we have a valid GPE number */ @@ -583,7 +588,7 @@ acpi_install_gpe_handler(acpi_handle gpe gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (!gpe_event_info) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure that there isn't a handler there already */ @@ -591,7 +596,7 @@ acpi_install_gpe_handler(acpi_handle gpe if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { status = AE_ALREADY_EXISTS; - goto unlock_and_exit; + goto unlock; } /* Allocate and init handler object */ @@ -599,7 +604,7 @@ acpi_install_gpe_handler(acpi_handle gpe handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info)); if (!handler) { status = AE_NO_MEMORY; - goto unlock_and_exit; + goto unlock; } handler->address = address; @@ -610,7 +615,7 @@ acpi_install_gpe_handler(acpi_handle gpe status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - goto unlock_and_exit; + goto unlock; } /* Install the handler */ @@ -625,8 +630,12 @@ acpi_install_gpe_handler(acpi_handle gpe acpi_os_release_lock(acpi_gbl_gpe_lock, flags); - unlock_and_exit: +unlock: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); +exit: + if (ACPI_FAILURE(status)) + ACPI_EXCEPTION((AE_INFO, status, + "Installing notify handler failed")); return_ACPI_STATUS(status); }