diff mbox

[kvm-unit-tests] vmx: always do vmxoff, even if test init function failed

Message ID 1403176411-31252-1-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini June 19, 2014, 11:13 a.m. UTC
Otherwise, the next test breaks with "vmxon failed".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 x86/vmx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/x86/vmx.c b/x86/vmx.c
index 5bb5969..2d601cc 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -868,7 +868,7 @@  static int test_run(struct vmx_test *test)
 	/* Directly call test->init is ok here, init_vmcs has done
 	   vmcs init, vmclear and vmptrld*/
 	if (test->init && test->init(test->vmcs) != VMX_TEST_START)
-		return 0;
+		goto out;
 	test->exits = 0;
 	current = test;
 	regs = test->guest_regs;
@@ -876,6 +876,7 @@  static int test_run(struct vmx_test *test)
 	launched = 0;
 	printf("\nTest suite: %s\n", test->name);
 	vmx_run();
+out:
 	if (vmx_off()) {
 		printf("%s : vmxoff failed.\n", __func__);
 		return 1;