aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2014-04-10 10:24:41 +0200
committerLuiz Capitulino <lcapitulino@redhat.com>2014-05-08 14:20:00 -0400
commit7a98593b34d3e19d77c43a69dd47f2387250d67d (patch)
tree9445fa4f048bd4df20504ae8ed90ae5391bc3cd6
parent64135217a75ac6c4e672ed67cb8fee7a4c16ada4 (diff)
downloadqemu-7a98593b34d3e19d77c43a69dd47f2387250d67d.zip
qemu-7a98593b34d3e19d77c43a69dd47f2387250d67d.tar.gz
qemu-7a98593b34d3e19d77c43a69dd47f2387250d67d.tar.bz2
pci-assign: propagate errors from assigned_dev_register_msix_mmio()
The return type is also changed from "int" to "void", because it was used in a success vs. failure sense only (the caller didn't distinguish error codes from each other, and even assigned_dev_register_msix_mmio() masked mmap()'s errno values with a common -EFAULT). Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
-rw-r--r--hw/i386/kvm/pci-assign.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 2de6559..3a904e8 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -1644,20 +1644,19 @@ static void assigned_dev_msix_reset(AssignedDevice *dev)
}
}
-static int assigned_dev_register_msix_mmio(AssignedDevice *dev)
+static void assigned_dev_register_msix_mmio(AssignedDevice *dev, Error **errp)
{
dev->msix_table = mmap(NULL, MSIX_PAGE_SIZE, PROT_READ|PROT_WRITE,
MAP_ANONYMOUS|MAP_PRIVATE, 0, 0);
if (dev->msix_table == MAP_FAILED) {
- error_report("fail allocate msix_table! %s", strerror(errno));
- return -EFAULT;
+ error_setg_errno(errp, errno, "failed to allocate msix_table");
+ return;
}
assigned_dev_msix_reset(dev);
memory_region_init_io(&dev->mmio, OBJECT(dev), &assigned_dev_msix_mmio_ops,
dev, "assigned-dev-msix", MSIX_PAGE_SIZE);
- return 0;
}
static void assigned_dev_unregister_msix_mmio(AssignedDevice *dev)
@@ -1788,7 +1787,10 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
/* intercept MSI-X entry page in the MMIO */
if (dev->cap.available & ASSIGNED_DEVICE_CAP_MSIX) {
- if (assigned_dev_register_msix_mmio(dev)) {
+ assigned_dev_register_msix_mmio(dev, &local_err);
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
goto out;
}
}