From: Dan Carpenter Date: Wed, 29 Jan 2014 13:16:39 +0000 (+0300) Subject: KVM: return an error code in kvm_vm_ioctl_register_coalesced_mmio() X-Git-Tag: upstream/snapshot3+hdmi~3425^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aac5c4226e7136c331ed384c25d5560204da10a0;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git KVM: return an error code in kvm_vm_ioctl_register_coalesced_mmio() If kvm_io_bus_register_dev() fails then it returns success but it should return an error code. I also did a little cleanup like removing an impossible NULL test. Cc: stable@vger.kernel.org Fixes: 2b3c246a682c ('KVM: Make coalesced mmio use a device per zone') Signed-off-by: Dan Carpenter Signed-off-by: Paolo Bonzini --- diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c index 88b2fe3..00d8642 100644 --- a/virt/kvm/coalesced_mmio.c +++ b/virt/kvm/coalesced_mmio.c @@ -154,17 +154,13 @@ int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm, list_add_tail(&dev->list, &kvm->coalesced_zones); mutex_unlock(&kvm->slots_lock); - return ret; + return 0; out_free_dev: mutex_unlock(&kvm->slots_lock); - kfree(dev); - if (dev == NULL) - return -ENXIO; - - return 0; + return ret; } int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,