diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2014-09-04 15:13:33 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-09-05 06:01:15 -0400 |
commit | f2a25160887e00434ce1361007009120e1fecbda (patch) | |
tree | 1eaa0d6d07eceda78a312be14c9459629560890b /virt/kvm/kvm_main.c | |
parent | a13f533b2f1d53a7c0baa7490498caeab7bc8ba5 (diff) |
KVM: remove redundant assignments in __kvm_set_memory_region
__kvm_set_memory_region sets r to EINVAL very early.
Doing it again is not necessary. The same is true later on, where
r is assigned -ENOMEM twice.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r-- | virt/kvm/kvm_main.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index de1ae82ba192..c338599804e0 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -793,7 +793,6 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
793 | base_gfn = mem->guest_phys_addr >> PAGE_SHIFT; | 793 | base_gfn = mem->guest_phys_addr >> PAGE_SHIFT; |
794 | npages = mem->memory_size >> PAGE_SHIFT; | 794 | npages = mem->memory_size >> PAGE_SHIFT; |
795 | 795 | ||
796 | r = -EINVAL; | ||
797 | if (npages > KVM_MEM_MAX_NR_PAGES) | 796 | if (npages > KVM_MEM_MAX_NR_PAGES) |
798 | goto out; | 797 | goto out; |
799 | 798 | ||
@@ -807,7 +806,6 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
807 | new.npages = npages; | 806 | new.npages = npages; |
808 | new.flags = mem->flags; | 807 | new.flags = mem->flags; |
809 | 808 | ||
810 | r = -EINVAL; | ||
811 | if (npages) { | 809 | if (npages) { |
812 | if (!old.npages) | 810 | if (!old.npages) |
813 | change = KVM_MR_CREATE; | 811 | change = KVM_MR_CREATE; |
@@ -863,7 +861,6 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
863 | } | 861 | } |
864 | 862 | ||
865 | if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) { | 863 | if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) { |
866 | r = -ENOMEM; | ||
867 | slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), | 864 | slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), |
868 | GFP_KERNEL); | 865 | GFP_KERNEL); |
869 | if (!slots) | 866 | if (!slots) |