|
@@ -428,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle device,
|
|
node = acpi_ns_map_handle_to_node(device);
|
|
node = acpi_ns_map_handle_to_node(device);
|
|
if (!node) {
|
|
if (!node) {
|
|
status = AE_BAD_PARAMETER;
|
|
status = AE_BAD_PARAMETER;
|
|
- goto unlock;
|
|
|
|
|
|
+ goto unlock_and_exit;
|
|
}
|
|
}
|
|
|
|
|
|
/* Root Object */
|
|
/* Root Object */
|
|
@@ -442,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle device,
|
|
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
|
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
|
!acpi_gbl_device_notify.handler)) {
|
|
!acpi_gbl_device_notify.handler)) {
|
|
status = AE_NOT_EXIST;
|
|
status = AE_NOT_EXIST;
|
|
- goto unlock;
|
|
|
|
|
|
+ goto unlock_and_exit;
|
|
}
|
|
}
|
|
|
|
|
|
/* Make sure all deferred tasks are completed */
|
|
/* Make sure all deferred tasks are completed */
|
|
@@ -474,7 +474,7 @@ acpi_remove_notify_handler(acpi_handle device,
|
|
|
|
|
|
if (!acpi_ev_is_notify_object(node)) {
|
|
if (!acpi_ev_is_notify_object(node)) {
|
|
status = AE_TYPE;
|
|
status = AE_TYPE;
|
|
- goto unlock;
|
|
|
|
|
|
+ goto unlock_and_exit;
|
|
}
|
|
}
|
|
|
|
|
|
/* Check for an existing internal object */
|
|
/* Check for an existing internal object */
|
|
@@ -482,17 +482,21 @@ acpi_remove_notify_handler(acpi_handle device,
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
|
if (!obj_desc) {
|
|
if (!obj_desc) {
|
|
status = AE_NOT_EXIST;
|
|
status = AE_NOT_EXIST;
|
|
- goto unlock;
|
|
|
|
|
|
+ goto unlock_and_exit;
|
|
}
|
|
}
|
|
|
|
|
|
/* Object exists - make sure there's an existing handler */
|
|
/* Object exists - make sure there's an existing handler */
|
|
|
|
|
|
if (handler_type & ACPI_SYSTEM_NOTIFY) {
|
|
if (handler_type & ACPI_SYSTEM_NOTIFY) {
|
|
notify_obj = obj_desc->common_notify.system_notify;
|
|
notify_obj = obj_desc->common_notify.system_notify;
|
|
- if ((!notify_obj) ||
|
|
|
|
- (notify_obj->notify.handler != handler)) {
|
|
|
|
|
|
+ if (!notify_obj) {
|
|
|
|
+ status = AE_NOT_EXIST;
|
|
|
|
+ goto unlock_and_exit;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (notify_obj->notify.handler != handler) {
|
|
status = AE_BAD_PARAMETER;
|
|
status = AE_BAD_PARAMETER;
|
|
- goto unlock;
|
|
|
|
|
|
+ goto unlock_and_exit;
|
|
}
|
|
}
|
|
/* Make sure all deferred tasks are completed */
|
|
/* Make sure all deferred tasks are completed */
|
|
|
|
|
|
@@ -510,10 +514,14 @@ acpi_remove_notify_handler(acpi_handle device,
|
|
|
|
|
|
if (handler_type & ACPI_DEVICE_NOTIFY) {
|
|
if (handler_type & ACPI_DEVICE_NOTIFY) {
|
|
notify_obj = obj_desc->common_notify.device_notify;
|
|
notify_obj = obj_desc->common_notify.device_notify;
|
|
- if ((!notify_obj) ||
|
|
|
|
- (notify_obj->notify.handler != handler)) {
|
|
|
|
|
|
+ if (!notify_obj) {
|
|
|
|
+ status = AE_NOT_EXIST;
|
|
|
|
+ goto unlock_and_exit;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (notify_obj->notify.handler != handler) {
|
|
status = AE_BAD_PARAMETER;
|
|
status = AE_BAD_PARAMETER;
|
|
- goto unlock;
|
|
|
|
|
|
+ goto unlock_and_exit;
|
|
}
|
|
}
|
|
/* Make sure all deferred tasks are completed */
|
|
/* Make sure all deferred tasks are completed */
|
|
|
|
|
|
@@ -530,9 +538,9 @@ acpi_remove_notify_handler(acpi_handle device,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-unlock:
|
|
|
|
|
|
+ unlock_and_exit:
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
-exit:
|
|
|
|
|
|
+ exit:
|
|
if (ACPI_FAILURE(status))
|
|
if (ACPI_FAILURE(status))
|
|
ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler"));
|
|
ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler"));
|
|
return_ACPI_STATUS(status);
|
|
return_ACPI_STATUS(status);
|
|
@@ -586,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
|
if (!gpe_event_info) {
|
|
if (!gpe_event_info) {
|
|
status = AE_BAD_PARAMETER;
|
|
status = AE_BAD_PARAMETER;
|
|
- goto unlock;
|
|
|
|
|
|
+ goto unlock_and_exit;
|
|
}
|
|
}
|
|
|
|
|
|
/* Make sure that there isn't a handler there already */
|
|
/* Make sure that there isn't a handler there already */
|
|
@@ -594,7 +602,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
|
|
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
|
|
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
|
|
ACPI_GPE_DISPATCH_HANDLER) {
|
|
ACPI_GPE_DISPATCH_HANDLER) {
|
|
status = AE_ALREADY_EXISTS;
|
|
status = AE_ALREADY_EXISTS;
|
|
- goto unlock;
|
|
|
|
|
|
+ goto unlock_and_exit;
|
|
}
|
|
}
|
|
|
|
|
|
/* Allocate and init handler object */
|
|
/* Allocate and init handler object */
|
|
@@ -602,7 +610,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
|
|
handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
|
|
handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
|
|
if (!handler) {
|
|
if (!handler) {
|
|
status = AE_NO_MEMORY;
|
|
status = AE_NO_MEMORY;
|
|
- goto unlock;
|
|
|
|
|
|
+ goto unlock_and_exit;
|
|
}
|
|
}
|
|
|
|
|
|
handler->address = address;
|
|
handler->address = address;
|
|
@@ -613,7 +621,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
|
|
|
|
|
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
|
if (ACPI_FAILURE(status)) {
|
|
if (ACPI_FAILURE(status)) {
|
|
- goto unlock;
|
|
|
|
|
|
+ goto unlock_and_exit;
|
|
}
|
|
}
|
|
|
|
|
|
/* Install the handler */
|
|
/* Install the handler */
|
|
@@ -628,9 +636,9 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
|
|
|
|
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
|
|
|
|
|
-unlock:
|
|
|
|
|
|
+ unlock_and_exit:
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
|
-exit:
|
|
|
|
|
|
+ exit:
|
|
if (ACPI_FAILURE(status))
|
|
if (ACPI_FAILURE(status))
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
|
"Installing notify handler failed"));
|
|
"Installing notify handler failed"));
|