KVM: s390: unregister debug feature on failing arch init
[ Upstream commit 308c3e6673
]
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 <mimu@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181130143215.69496-2-mimu@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2135588adb
commit
cdf2e054bb
@ -361,19 +361,30 @@ static void kvm_s390_cpu_feat_init(void)
|
|||||||
|
|
||||||
int kvm_arch_init(void *opaque)
|
int kvm_arch_init(void *opaque)
|
||||||
{
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
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)) {
|
||||||
debug_unregister(kvm_s390_dbf);
|
rc = -ENOMEM;
|
||||||
return -ENOMEM;
|
goto out_debug_unreg;
|
||||||
}
|
}
|
||||||
|
|
||||||
kvm_s390_cpu_feat_init();
|
kvm_s390_cpu_feat_init();
|
||||||
|
|
||||||
/* Register floating interrupt controller interface. */
|
/* 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)
|
void kvm_arch_exit(void)
|
||||||
|
Reference in New Issue
Block a user