Skip to content

Commit

Permalink
KVM: s390: unregister debug feature on failing arch init
Browse files Browse the repository at this point in the history
Make sure the debug feature and its allocated resources get
released upon unsuccessful architecture initialization.

A related indication of the issue will be reported as kernel
message.

Signed-off-by: Michael Mueller <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Pierre Morel <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Christian Borntraeger <[email protected]>
  • Loading branch information
Michael Mueller authored and borntraeger committed Dec 18, 2018
1 parent ccda4af commit 308c3e6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions arch/s390/kvm/kvm-s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,19 +417,30 @@ static void kvm_s390_cpu_feat_init(void)

int kvm_arch_init(void *opaque)
{
int rc;

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

if (debug_register_view(kvm_s390_dbf, &debug_sprintf_view)) {
debug_unregister(kvm_s390_dbf);
return -ENOMEM;
rc = -ENOMEM;
goto out_debug_unreg;
}

kvm_s390_cpu_feat_init();

/* Register floating interrupt controller interface. */
return 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) {
pr_err("Failed to register FLIC rc=%d\n", rc);
goto out_debug_unreg;
}
return 0;

out_debug_unreg:
debug_unregister(kvm_s390_dbf);
return rc;
}

void kvm_arch_exit(void)
Expand Down

0 comments on commit 308c3e6

Please sign in to comment.