diff options
author | Laszlo Ersek <lersek@redhat.com> | 2014-04-10 10:24:45 +0200 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-05-08 14:20:00 -0400 |
commit | 636713bad4240836947c04c26e1cd001d3bcbff1 (patch) | |
tree | 9a1e24f6773e337eadf1ceb3c0ef67b8f68ab27d | |
parent | ef47827ac4da5217243e1fec7ec75c1924eb4f40 (diff) | |
download | qemu-636713bad4240836947c04c26e1cd001d3bcbff1.zip qemu-636713bad4240836947c04c26e1cd001d3bcbff1.tar.gz qemu-636713bad4240836947c04c26e1cd001d3bcbff1.tar.bz2 |
pci-assign: assigned_initfn(): set monitor error in common error handler
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.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index 6891729..e55421a 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -1756,14 +1756,14 @@ static int assigned_initfn(struct PCIDevice *pci_dev) Error *local_err = NULL; if (!kvm_enabled()) { - error_report("pci-assign: error: requires KVM support"); - return -1; + error_setg(&local_err, "pci-assign requires KVM support"); + goto exit_with_error; } if (!dev->host.domain && !dev->host.bus && !dev->host.slot && !dev->host.function) { - error_report("pci-assign: error: no host device specified"); - return -1; + error_setg(&local_err, "no host device specified"); + goto exit_with_error; } /* @@ -1788,14 +1788,10 @@ static int assigned_initfn(struct PCIDevice *pci_dev) get_real_device(dev, &local_err); if (local_err) { - qerror_report_err(local_err); - error_free(local_err); goto out; } if (assigned_device_pci_cap_init(pci_dev, &local_err) < 0) { - qerror_report_err(local_err); - error_free(local_err); goto out; } @@ -1803,8 +1799,6 @@ static int assigned_initfn(struct PCIDevice *pci_dev) if (dev->cap.available & ASSIGNED_DEVICE_CAP_MSIX) { assigned_dev_register_msix_mmio(dev, &local_err); if (local_err) { - qerror_report_err(local_err); - error_free(local_err); goto out; } } @@ -1814,8 +1808,6 @@ static int assigned_initfn(struct PCIDevice *pci_dev) dev->real_device.region_number, dev, &local_err); if (local_err) { - qerror_report_err(local_err); - error_free(local_err); goto out; } @@ -1828,16 +1820,12 @@ static int assigned_initfn(struct PCIDevice *pci_dev) /* assign device to guest */ assign_device(dev, &local_err); if (local_err) { - qerror_report_err(local_err); - error_free(local_err); goto out; } /* assign legacy INTx to the device */ r = assign_intx(dev, &local_err); if (r < 0) { - qerror_report_err(local_err); - error_free(local_err); goto assigned_out; } @@ -1849,8 +1837,14 @@ static int assigned_initfn(struct PCIDevice *pci_dev) assigned_out: deassign_device(dev); + out: free_assigned_device(dev); + +exit_with_error: + assert(local_err); + qerror_report_err(local_err); + error_free(local_err); return -1; } |