提交 f2a25160 编写于 作者: C Christian Borntraeger 提交者: Paolo Bonzini

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: NChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 a13f533b
...@@ -793,7 +793,6 @@ int __kvm_set_memory_region(struct kvm *kvm, ...@@ -793,7 +793,6 @@ int __kvm_set_memory_region(struct kvm *kvm,
base_gfn = mem->guest_phys_addr >> PAGE_SHIFT; base_gfn = mem->guest_phys_addr >> PAGE_SHIFT;
npages = mem->memory_size >> PAGE_SHIFT; npages = mem->memory_size >> PAGE_SHIFT;
r = -EINVAL;
if (npages > KVM_MEM_MAX_NR_PAGES) if (npages > KVM_MEM_MAX_NR_PAGES)
goto out; goto out;
...@@ -807,7 +806,6 @@ int __kvm_set_memory_region(struct kvm *kvm, ...@@ -807,7 +806,6 @@ int __kvm_set_memory_region(struct kvm *kvm,
new.npages = npages; new.npages = npages;
new.flags = mem->flags; new.flags = mem->flags;
r = -EINVAL;
if (npages) { if (npages) {
if (!old.npages) if (!old.npages)
change = KVM_MR_CREATE; change = KVM_MR_CREATE;
...@@ -863,7 +861,6 @@ int __kvm_set_memory_region(struct kvm *kvm, ...@@ -863,7 +861,6 @@ int __kvm_set_memory_region(struct kvm *kvm,
} }
if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) { if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) {
r = -ENOMEM;
slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots),
GFP_KERNEL); GFP_KERNEL);
if (!slots) if (!slots)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册