KVM: set_memory_region: Don't jump to out_free unnecessarily
authorTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Fri, 11 Jan 2013 09:26:10 +0000 (18:26 +0900)
committerGleb Natapov <gleb@redhat.com>
Thu, 17 Jan 2013 12:27:43 +0000 (14:27 +0200)
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>
virt/kvm/kvm_main.c

index f689a6d7f9d4308ca62c302f40ecf8914130ed0b..28eb160fd4870eacad52f0d901721d22e011a90c 100644 (file)
@@ -778,9 +778,9 @@ int __kvm_set_memory_region(struct kvm *kvm,
         */
        r = -EINVAL;
        if (npages && old.npages && npages != old.npages)
-               goto out_free;
+               goto out;
        if (!npages && !old.npages)
-               goto out_free;
+               goto out;
 
        /* Check for overlaps */
        r = -EEXIST;
@@ -789,7 +789,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
                        continue;
                if (!((base_gfn + npages <= slot->base_gfn) ||
                      (base_gfn >= slot->base_gfn + slot->npages)))
-                       goto out_free;
+                       goto out;
        }
 
        /* Free page dirty bitmap if unneeded */
@@ -890,7 +890,6 @@ out_free:
        kvm_free_physmem_slot(&new, &old);
 out:
        return r;
-
 }
 EXPORT_SYMBOL_GPL(__kvm_set_memory_region);