[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/3] vfio/pci: Do not unwind on error
From: |
Alex Williamson |
Subject: |
[Qemu-devel] [PULL 1/3] vfio/pci: Do not unwind on error |
Date: |
Tue, 03 Oct 2017 16:12:36 -0600 |
User-agent: |
StGit/0.17.1-dirty |
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 <address@hidden>
---
hw/vfio/pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 31e1edf44745..916d365dfab3 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 address@hidden: ",