From: Takuya Yoshikawa Date: Fri, 11 Jan 2013 09:26:10 +0000 (+0900) Subject: KVM: set_memory_region: Don't jump to out_free unnecessarily X-Git-Tag: v5.15~20187^2~182 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ea75e1d26dd4ccbbfe4d1a5931903b15b82ba2a;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: Takuya Yoshikawa Signed-off-by: Gleb Natapov --- diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index f689a6d..28eb160 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, */ 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);