summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2017-08-29 16:05:32 -0600
committerAlex Williamson <alex.williamson@redhat.com>2017-10-03 12:57:35 -0600
commit5b31c8229d903f27b7d6e3aa5c59e660dcc5908b (patch)
tree9aa1a212d810f70632fa3b74573f608e9901208d
parentd147f7e815f97cb477e223586bcb80c316ae10ea (diff)
downloadfocaccia-qemu-5b31c8229d903f27b7d6e3aa5c59e660dcc5908b.tar.gz
focaccia-qemu-5b31c8229d903f27b7d6e3aa5c59e660dcc5908b.zip
vfio/pci: Do not unwind on error
If vfio_add_std_cap() errors then going to out prepends irrelevant
errors for capabilities we haven't attempted to add as we unwind our
recursive stack.  Just return error.

Fixes: 7ef165b9a8d9 ("vfio/pci: Pass an error object to vfio_add_capabilities")
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to '')
-rw-r--r--hw/vfio/pci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 31e1edf447..916d365dfa 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -1826,7 +1826,7 @@ static int vfio_add_std_cap(VFIOPCIDevice *vdev, uint8_t pos, Error **errp)
     if (next) {
         ret = vfio_add_std_cap(vdev, next, errp);
         if (ret) {
-            goto out;
+            return ret;
         }
     } else {
         /* Begin the rebuild, use QEMU emulated list bits */
@@ -1862,7 +1862,7 @@ static int vfio_add_std_cap(VFIOPCIDevice *vdev, uint8_t pos, Error **errp)
         ret = pci_add_capability(pdev, cap_id, pos, size, errp);
         break;
     }
-out:
+
     if (ret < 0) {
         error_prepend(errp,
                       "failed to add PCI capability 0x%x[0x%x]@0x%x: ",