@@ -428,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle device,
428428 node = acpi_ns_map_handle_to_node (device );
429429 if (!node ) {
430430 status = AE_BAD_PARAMETER ;
431- goto unlock ;
431+ goto unlock_and_exit ;
432432 }
433433
434434 /* Root Object */
@@ -442,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle device,
442442 ((handler_type & ACPI_DEVICE_NOTIFY ) &&
443443 !acpi_gbl_device_notify .handler )) {
444444 status = AE_NOT_EXIST ;
445- goto unlock ;
445+ goto unlock_and_exit ;
446446 }
447447
448448 /* Make sure all deferred tasks are completed */
@@ -474,25 +474,29 @@ acpi_remove_notify_handler(acpi_handle device,
474474
475475 if (!acpi_ev_is_notify_object (node )) {
476476 status = AE_TYPE ;
477- goto unlock ;
477+ goto unlock_and_exit ;
478478 }
479479
480480 /* Check for an existing internal object */
481481
482482 obj_desc = acpi_ns_get_attached_object (node );
483483 if (!obj_desc ) {
484484 status = AE_NOT_EXIST ;
485- goto unlock ;
485+ goto unlock_and_exit ;
486486 }
487487
488488 /* Object exists - make sure there's an existing handler */
489489
490490 if (handler_type & ACPI_SYSTEM_NOTIFY ) {
491491 notify_obj = obj_desc -> common_notify .system_notify ;
492- if ((!notify_obj ) ||
493- (notify_obj -> notify .handler != handler )) {
492+ if (!notify_obj ) {
493+ status = AE_NOT_EXIST ;
494+ goto unlock_and_exit ;
495+ }
496+
497+ if (notify_obj -> notify .handler != handler ) {
494498 status = AE_BAD_PARAMETER ;
495- goto unlock ;
499+ goto unlock_and_exit ;
496500 }
497501 /* Make sure all deferred tasks are completed */
498502
@@ -510,10 +514,14 @@ acpi_remove_notify_handler(acpi_handle device,
510514
511515 if (handler_type & ACPI_DEVICE_NOTIFY ) {
512516 notify_obj = obj_desc -> common_notify .device_notify ;
513- if ((!notify_obj ) ||
514- (notify_obj -> notify .handler != handler )) {
517+ if (!notify_obj ) {
518+ status = AE_NOT_EXIST ;
519+ goto unlock_and_exit ;
520+ }
521+
522+ if (notify_obj -> notify .handler != handler ) {
515523 status = AE_BAD_PARAMETER ;
516- goto unlock ;
524+ goto unlock_and_exit ;
517525 }
518526 /* Make sure all deferred tasks are completed */
519527
@@ -530,9 +538,9 @@ acpi_remove_notify_handler(acpi_handle device,
530538 }
531539 }
532540
533- unlock :
541+ unlock_and_exit :
534542 (void )acpi_ut_release_mutex (ACPI_MTX_NAMESPACE );
535- exit :
543+ exit :
536544 if (ACPI_FAILURE (status ))
537545 ACPI_EXCEPTION ((AE_INFO , status , "Removing notify handler" ));
538546 return_ACPI_STATUS (status );
@@ -586,23 +594,23 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
586594 gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device , gpe_number );
587595 if (!gpe_event_info ) {
588596 status = AE_BAD_PARAMETER ;
589- goto unlock ;
597+ goto unlock_and_exit ;
590598 }
591599
592600 /* Make sure that there isn't a handler there already */
593601
594602 if ((gpe_event_info -> flags & ACPI_GPE_DISPATCH_MASK ) ==
595603 ACPI_GPE_DISPATCH_HANDLER ) {
596604 status = AE_ALREADY_EXISTS ;
597- goto unlock ;
605+ goto unlock_and_exit ;
598606 }
599607
600608 /* Allocate and init handler object */
601609
602610 handler = ACPI_ALLOCATE_ZEROED (sizeof (struct acpi_handler_info ));
603611 if (!handler ) {
604612 status = AE_NO_MEMORY ;
605- goto unlock ;
613+ goto unlock_and_exit ;
606614 }
607615
608616 handler -> address = address ;
@@ -613,7 +621,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
613621
614622 status = acpi_ev_disable_gpe (gpe_event_info );
615623 if (ACPI_FAILURE (status )) {
616- goto unlock ;
624+ goto unlock_and_exit ;
617625 }
618626
619627 /* Install the handler */
@@ -628,9 +636,9 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
628636
629637 acpi_os_release_lock (acpi_gbl_gpe_lock , flags );
630638
631- unlock :
639+ unlock_and_exit :
632640 (void )acpi_ut_release_mutex (ACPI_MTX_EVENTS );
633- exit :
641+ exit :
634642 if (ACPI_FAILURE (status ))
635643 ACPI_EXCEPTION ((AE_INFO , status ,
636644 "Installing notify handler failed" ));
0 commit comments