aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/kvm_main.c
diff options
context:
space:
mode:
authorTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>2013-01-11 04:26:10 -0500
committerGleb Natapov <gleb@redhat.com>2013-01-17 07:27:43 -0500
commit0ea75e1d26dd4ccbbfe4d1a5931903b15b82ba2a (patch)
tree83aed7450eb5f2eea111a5da578e37285f6e065b /virt/kvm/kvm_main.c
parenta046b816a4587c7898772af7cc7e6798cc8b56dd (diff)
KVM: set_memory_region: Don't jump to out_free unnecessarily
This makes the separation between the sanity checks and the rest of the code a bit clearer. Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp> Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r--virt/kvm/kvm_main.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index f689a6d7f9d4..28eb160fd487 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -778,9 +778,9 @@ int __kvm_set_memory_region(struct kvm *kvm,
778 */ 778 */
779 r = -EINVAL; 779 r = -EINVAL;
780 if (npages && old.npages && npages != old.npages) 780 if (npages && old.npages && npages != old.npages)
781 goto out_free; 781 goto out;
782 if (!npages && !old.npages) 782 if (!npages && !old.npages)
783 goto out_free; 783 goto out;
784 784
785 /* Check for overlaps */ 785 /* Check for overlaps */
786 r = -EEXIST; 786 r = -EEXIST;
@@ -789,7 +789,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
789 continue; 789 continue;
790 if (!((base_gfn + npages <= slot->base_gfn) || 790 if (!((base_gfn + npages <= slot->base_gfn) ||
791 (base_gfn >= slot->base_gfn + slot->npages))) 791 (base_gfn >= slot->base_gfn + slot->npages)))
792 goto out_free; 792 goto out;
793 } 793 }
794 794
795 /* Free page dirty bitmap if unneeded */ 795 /* Free page dirty bitmap if unneeded */
@@ -890,7 +890,6 @@ out_free:
890 kvm_free_physmem_slot(&new, &old); 890 kvm_free_physmem_slot(&new, &old);
891out: 891out:
892 return r; 892 return r;
893
894} 893}
895EXPORT_SYMBOL_GPL(__kvm_set_memory_region); 894EXPORT_SYMBOL_GPL(__kvm_set_memory_region);
896 895