Skip to content

Commit f76f637

Browse files
frankjaaborntraeger
authored andcommitted
KVM: s390: Cleanup kvm_arch_init error path
Both kvm_s390_gib_destroy and debug_unregister test if the needed pointers are not NULL and hence can be called unconditionally. Signed-off-by: Janosch Frank <[email protected]> Link: https://lore.kernel.org/kvm/[email protected] Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Thomas Huth <[email protected]> Signed-off-by: Christian Borntraeger <[email protected]>
1 parent 7775cba commit f76f637

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

arch/s390/kvm/kvm-s390.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -453,36 +453,32 @@ static void kvm_s390_cpu_feat_init(void)
453453

454454
int kvm_arch_init(void *opaque)
455455
{
456-
int rc;
456+
int rc = -ENOMEM;
457457

458458
kvm_s390_dbf = debug_register("kvm-trace", 32, 1, 7 * sizeof(long));
459459
if (!kvm_s390_dbf)
460460
return -ENOMEM;
461461

462-
if (debug_register_view(kvm_s390_dbf, &debug_sprintf_view)) {
463-
rc = -ENOMEM;
464-
goto out_debug_unreg;
465-
}
462+
if (debug_register_view(kvm_s390_dbf, &debug_sprintf_view))
463+
goto out;
466464

467465
kvm_s390_cpu_feat_init();
468466

469467
/* Register floating interrupt controller interface. */
470468
rc = kvm_register_device_ops(&kvm_flic_ops, KVM_DEV_TYPE_FLIC);
471469
if (rc) {
472470
pr_err("A FLIC registration call failed with rc=%d\n", rc);
473-
goto out_debug_unreg;
471+
goto out;
474472
}
475473

476474
rc = kvm_s390_gib_init(GAL_ISC);
477475
if (rc)
478-
goto out_gib_destroy;
476+
goto out;
479477

480478
return 0;
481479

482-
out_gib_destroy:
483-
kvm_s390_gib_destroy();
484-
out_debug_unreg:
485-
debug_unregister(kvm_s390_dbf);
480+
out:
481+
kvm_arch_exit();
486482
return rc;
487483
}
488484

0 commit comments

Comments
 (0)