]> Git Repo - qemu.git/commitdiff
vfio/pci: Do not unwind on error
authorAlex Williamson <[email protected]>
Tue, 29 Aug 2017 22:05:32 +0000 (16:05 -0600)
committerAlex Williamson <[email protected]>
Tue, 3 Oct 2017 18:57:35 +0000 (12:57 -0600)
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 <[email protected]>
hw/vfio/pci.c

index 31e1edf447455b1c829e13b4197d2854a79fd52f..916d365dfab3fc776b34081a9ba9c60b5d6d1c2c 100644 (file)
@@ -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: ",
This page took 0.030555 seconds and 4 git commands to generate.