diff --git a/drivers/virt/gunyah/gh_guest_pops.c b/drivers/virt/gunyah/gh_guest_pops.c index c5446362634d..6abe6fb652dd 100644 --- a/drivers/virt/gunyah/gh_guest_pops.c +++ b/drivers/virt/gunyah/gh_guest_pops.c @@ -91,21 +91,19 @@ static int __init gh_guest_pops_init_poff(void) input_set_capability(gh_vm_poff_input, EV_KEY, KEY_POWER); ret = input_register_device(gh_vm_poff_input); - if (ret) - goto fail_register; + if (ret) { + input_free_device(gh_vm_poff_input); + return ret; + } rm_nb.notifier_call = gh_guest_pops_rm_notifer_fn; ret = gh_rm_register_notifier(&rm_nb); - if (ret) - goto fail_init; + if (ret) { + input_unregister_device(gh_vm_poff_input); + return ret; + } return 0; - -fail_init: - input_unregister_device(gh_vm_poff_input); -fail_register: - input_free_device(gh_vm_poff_input); - return ret; } static ssize_t gh_guest_set_app_status(struct kobject *kobj, @@ -187,7 +185,6 @@ static void gh_guest_pops_exit_poff(void) gh_rm_unregister_notifier(&rm_nb); input_unregister_device(gh_vm_poff_input); - input_free_device(gh_vm_poff_input); } static int __init gh_guest_pops_init(void)