There's no need to translate virDomainHostdevDef-s into virPCIDevice-s with locked list of PCI devices. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/util/virhostdev.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 5935d926aa..7b5ccf2daf 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -639,11 +639,11 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr, if (!nhostdevs) return 0; - virObjectLock(mgr->activePCIHostdevs); - virObjectLock(mgr->inactivePCIHostdevs); - if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))) - goto cleanup; + return -1; + + virObjectLock(mgr->activePCIHostdevs); + virObjectLock(mgr->inactivePCIHostdevs); /* Detaching devices from the host involves several steps; each * of them is described at length below. @@ -912,9 +912,9 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr, } cleanup: - virObjectUnref(pcidevs); virObjectUnlock(mgr->activePCIHostdevs); virObjectUnlock(mgr->inactivePCIHostdevs); + virObjectUnref(pcidevs); return ret; } -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list