Skip to content

Commit

Permalink
KVM: return an error code in kvm_vm_ioctl_register_coalesced_mmio()
Browse files Browse the repository at this point in the history
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: [email protected]
Fixes: 2b3c246 ('KVM: Make coalesced mmio use a device per zone')
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
Dan Carpenter authored and bonzini committed Jan 30, 2014
1 parent b73117c commit aac5c42
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions virt/kvm/coalesced_mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit aac5c42

Please sign in to comment.