Commit f76f6371 authored by Janosch Frank's avatar Janosch Frank Committed by Christian Borntraeger

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: default avatarJanosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/kvm/20191002075627.3582-1-frankja@linux.ibm.comReviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent 7775cbaa
...@@ -453,16 +453,14 @@ static void kvm_s390_cpu_feat_init(void) ...@@ -453,16 +453,14 @@ static void kvm_s390_cpu_feat_init(void)
int kvm_arch_init(void *opaque) int kvm_arch_init(void *opaque)
{ {
int rc; int rc = -ENOMEM;
kvm_s390_dbf = debug_register("kvm-trace", 32, 1, 7 * sizeof(long)); kvm_s390_dbf = debug_register("kvm-trace", 32, 1, 7 * sizeof(long));
if (!kvm_s390_dbf) if (!kvm_s390_dbf)
return -ENOMEM; return -ENOMEM;
if (debug_register_view(kvm_s390_dbf, &debug_sprintf_view)) { if (debug_register_view(kvm_s390_dbf, &debug_sprintf_view))
rc = -ENOMEM; goto out;
goto out_debug_unreg;
}
kvm_s390_cpu_feat_init(); kvm_s390_cpu_feat_init();
...@@ -470,19 +468,17 @@ int kvm_arch_init(void *opaque) ...@@ -470,19 +468,17 @@ int kvm_arch_init(void *opaque)
rc = kvm_register_device_ops(&kvm_flic_ops, KVM_DEV_TYPE_FLIC); rc = kvm_register_device_ops(&kvm_flic_ops, KVM_DEV_TYPE_FLIC);
if (rc) { if (rc) {
pr_err("A FLIC registration call failed with rc=%d\n", rc); pr_err("A FLIC registration call failed with rc=%d\n", rc);
goto out_debug_unreg; goto out;
} }
rc = kvm_s390_gib_init(GAL_ISC); rc = kvm_s390_gib_init(GAL_ISC);
if (rc) if (rc)
goto out_gib_destroy; goto out;
return 0; return 0;
out_gib_destroy: out:
kvm_s390_gib_destroy(); kvm_arch_exit();
out_debug_unreg:
debug_unregister(kvm_s390_dbf);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment