There's no need to translate virDomainHostdevDef-s into
virPCIDevice-s with locked list of PCI devices.

Signed-off-by: Michal Privoznik <[email protected]>
---
 src/util/virhostdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 7b5ccf2daf..79a6ec86fe 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -963,16 +963,16 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
     if (!nhostdevs)
         return;
 
-    virObjectLock(mgr->activePCIHostdevs);
-    virObjectLock(mgr->inactivePCIHostdevs);
-
     if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))) {
         VIR_ERROR(_("Failed to allocate PCI device list: %s"),
                   virGetLastErrorMessage());
         virResetLastError();
-        goto cleanup;
+        return;
     }
 
+    virObjectLock(mgr->activePCIHostdevs);
+    virObjectLock(mgr->inactivePCIHostdevs);
+
     /* Reattaching devices to the host involves several steps; each
      * of them is described at length below */
 
-- 
2.21.0

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to