diff options
Diffstat (limited to 'drivers/acpi/events/evxface.c')
-rw-r--r-- | drivers/acpi/events/evxface.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 4f948df17ab9..923fd2b46955 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -428,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
428 | node = acpi_ns_map_handle_to_node(device); | 428 | node = acpi_ns_map_handle_to_node(device); |
429 | if (!node) { | 429 | if (!node) { |
430 | status = AE_BAD_PARAMETER; | 430 | status = AE_BAD_PARAMETER; |
431 | goto unlock; | 431 | goto unlock_and_exit; |
432 | } | 432 | } |
433 | 433 | ||
434 | /* Root Object */ | 434 | /* Root Object */ |
@@ -442,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
442 | ((handler_type & ACPI_DEVICE_NOTIFY) && | 442 | ((handler_type & ACPI_DEVICE_NOTIFY) && |
443 | !acpi_gbl_device_notify.handler)) { | 443 | !acpi_gbl_device_notify.handler)) { |
444 | status = AE_NOT_EXIST; | 444 | status = AE_NOT_EXIST; |
445 | goto unlock; | 445 | goto unlock_and_exit; |
446 | } | 446 | } |
447 | 447 | ||
448 | /* Make sure all deferred tasks are completed */ | 448 | /* Make sure all deferred tasks are completed */ |
@@ -474,7 +474,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
474 | 474 | ||
475 | if (!acpi_ev_is_notify_object(node)) { | 475 | if (!acpi_ev_is_notify_object(node)) { |
476 | status = AE_TYPE; | 476 | status = AE_TYPE; |
477 | goto unlock; | 477 | goto unlock_and_exit; |
478 | } | 478 | } |
479 | 479 | ||
480 | /* Check for an existing internal object */ | 480 | /* Check for an existing internal object */ |
@@ -482,17 +482,21 @@ acpi_remove_notify_handler(acpi_handle device, | |||
482 | obj_desc = acpi_ns_get_attached_object(node); | 482 | obj_desc = acpi_ns_get_attached_object(node); |
483 | if (!obj_desc) { | 483 | if (!obj_desc) { |
484 | status = AE_NOT_EXIST; | 484 | status = AE_NOT_EXIST; |
485 | goto unlock; | 485 | goto unlock_and_exit; |
486 | } | 486 | } |
487 | 487 | ||
488 | /* Object exists - make sure there's an existing handler */ | 488 | /* Object exists - make sure there's an existing handler */ |
489 | 489 | ||
490 | if (handler_type & ACPI_SYSTEM_NOTIFY) { | 490 | if (handler_type & ACPI_SYSTEM_NOTIFY) { |
491 | notify_obj = obj_desc->common_notify.system_notify; | 491 | notify_obj = obj_desc->common_notify.system_notify; |
492 | if ((!notify_obj) || | 492 | if (!notify_obj) { |
493 | (notify_obj->notify.handler != handler)) { | 493 | status = AE_NOT_EXIST; |
494 | goto unlock_and_exit; | ||
495 | } | ||
496 | |||
497 | if (notify_obj->notify.handler != handler) { | ||
494 | status = AE_BAD_PARAMETER; | 498 | status = AE_BAD_PARAMETER; |
495 | goto unlock; | 499 | goto unlock_and_exit; |
496 | } | 500 | } |
497 | /* Make sure all deferred tasks are completed */ | 501 | /* Make sure all deferred tasks are completed */ |
498 | 502 | ||
@@ -510,10 +514,14 @@ acpi_remove_notify_handler(acpi_handle device, | |||
510 | 514 | ||
511 | if (handler_type & ACPI_DEVICE_NOTIFY) { | 515 | if (handler_type & ACPI_DEVICE_NOTIFY) { |
512 | notify_obj = obj_desc->common_notify.device_notify; | 516 | notify_obj = obj_desc->common_notify.device_notify; |
513 | if ((!notify_obj) || | 517 | if (!notify_obj) { |
514 | (notify_obj->notify.handler != handler)) { | 518 | status = AE_NOT_EXIST; |
519 | goto unlock_and_exit; | ||
520 | } | ||
521 | |||
522 | if (notify_obj->notify.handler != handler) { | ||
515 | status = AE_BAD_PARAMETER; | 523 | status = AE_BAD_PARAMETER; |
516 | goto unlock; | 524 | goto unlock_and_exit; |
517 | } | 525 | } |
518 | /* Make sure all deferred tasks are completed */ | 526 | /* Make sure all deferred tasks are completed */ |
519 | 527 | ||
@@ -530,9 +538,9 @@ acpi_remove_notify_handler(acpi_handle device, | |||
530 | } | 538 | } |
531 | } | 539 | } |
532 | 540 | ||
533 | unlock: | 541 | unlock_and_exit: |
534 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 542 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
535 | exit: | 543 | exit: |
536 | if (ACPI_FAILURE(status)) | 544 | if (ACPI_FAILURE(status)) |
537 | ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler")); | 545 | ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler")); |
538 | return_ACPI_STATUS(status); | 546 | return_ACPI_STATUS(status); |
@@ -586,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
586 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 594 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
587 | if (!gpe_event_info) { | 595 | if (!gpe_event_info) { |
588 | status = AE_BAD_PARAMETER; | 596 | status = AE_BAD_PARAMETER; |
589 | goto unlock; | 597 | goto unlock_and_exit; |
590 | } | 598 | } |
591 | 599 | ||
592 | /* Make sure that there isn't a handler there already */ | 600 | /* Make sure that there isn't a handler there already */ |
@@ -594,7 +602,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
594 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 602 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
595 | ACPI_GPE_DISPATCH_HANDLER) { | 603 | ACPI_GPE_DISPATCH_HANDLER) { |
596 | status = AE_ALREADY_EXISTS; | 604 | status = AE_ALREADY_EXISTS; |
597 | goto unlock; | 605 | goto unlock_and_exit; |
598 | } | 606 | } |
599 | 607 | ||
600 | /* Allocate and init handler object */ | 608 | /* Allocate and init handler object */ |
@@ -602,7 +610,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
602 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); | 610 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); |
603 | if (!handler) { | 611 | if (!handler) { |
604 | status = AE_NO_MEMORY; | 612 | status = AE_NO_MEMORY; |
605 | goto unlock; | 613 | goto unlock_and_exit; |
606 | } | 614 | } |
607 | 615 | ||
608 | handler->address = address; | 616 | handler->address = address; |
@@ -613,7 +621,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
613 | 621 | ||
614 | status = acpi_ev_disable_gpe(gpe_event_info); | 622 | status = acpi_ev_disable_gpe(gpe_event_info); |
615 | if (ACPI_FAILURE(status)) { | 623 | if (ACPI_FAILURE(status)) { |
616 | goto unlock; | 624 | goto unlock_and_exit; |
617 | } | 625 | } |
618 | 626 | ||
619 | /* Install the handler */ | 627 | /* Install the handler */ |
@@ -628,9 +636,9 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
628 | 636 | ||
629 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 637 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
630 | 638 | ||
631 | unlock: | 639 | unlock_and_exit: |
632 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 640 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
633 | exit: | 641 | exit: |
634 | if (ACPI_FAILURE(status)) | 642 | if (ACPI_FAILURE(status)) |
635 | ACPI_EXCEPTION((AE_INFO, status, | 643 | ACPI_EXCEPTION((AE_INFO, status, |
636 | "Installing notify handler failed")); | 644 | "Installing notify handler failed")); |