Skip to content

Commit

Permalink
vfio/pci: Do not unwind on error
Browse files Browse the repository at this point in the history
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: 7ef165b ("vfio/pci: Pass an error object to vfio_add_capabilities")
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
  • Loading branch information
awilliam committed Oct 3, 2017
1 parent d147f7e commit 5b31c82
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hw/vfio/pci.c
Expand Up @@ -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 */
Expand Down Expand Up @@ -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: ",
Expand Down

0 comments on commit 5b31c82

Please sign in to comment.