KVM: SVM: simplify nested_svm_check_exception
authorJoerg Roedel <joerg.roedel@amd.com>
Fri, 7 Aug 2009 09:49:37 +0000 (11:49 +0200)
committerAvi Kivity <avi@redhat.com>
Thu, 10 Sep 2009 05:33:25 +0000 (08:33 +0300)
Makes the code of this function more readable by removing on
indentation level for the core logic.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/svm.c

index 3bb6d4b92b34a63cb1fd90c747b797dea7ad1d5e..67fad6641d552b72d62cb31d2ad2bc5bf9befb3f 100644 (file)
@@ -1359,18 +1359,15 @@ static int nested_svm_check_permissions(struct vcpu_svm *svm)
 static int nested_svm_check_exception(struct vcpu_svm *svm, unsigned nr,
                                      bool has_error_code, u32 error_code)
 {
-       if (is_nested(svm)) {
-               svm->vmcb->control.exit_code = SVM_EXIT_EXCP_BASE + nr;
-               svm->vmcb->control.exit_code_hi = 0;
-               svm->vmcb->control.exit_info_1 = error_code;
-               svm->vmcb->control.exit_info_2 = svm->vcpu.arch.cr2;
-               if (nested_svm_exit_handled(svm, false)) {
-                       nsvm_printk("VMexit -> EXCP 0x%x\n", nr);
-                       return 1;
-               }
-       }
+       if (!is_nested(svm))
+               return 0;
 
-       return 0;
+       svm->vmcb->control.exit_code = SVM_EXIT_EXCP_BASE + nr;
+       svm->vmcb->control.exit_code_hi = 0;
+       svm->vmcb->control.exit_info_1 = error_code;
+       svm->vmcb->control.exit_info_2 = svm->vcpu.arch.cr2;
+
+       return nested_svm_exit_handled(svm, false);
 }
 
 static inline int nested_svm_intr(struct vcpu_svm *svm)