提交 bf450f5b 编写于 作者: M Michal Privoznik

virHostdevPreparePCIDevices: Construct pcidevs list earlier

There's no need to translate virDomainHostdevDef-s into
virPCIDevice-s with locked list of PCI devices.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 11fa712c
...@@ -639,12 +639,12 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr, ...@@ -639,12 +639,12 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
if (!nhostdevs) if (!nhostdevs)
return 0; return 0;
if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs)))
return -1;
virObjectLock(mgr->activePCIHostdevs); virObjectLock(mgr->activePCIHostdevs);
virObjectLock(mgr->inactivePCIHostdevs); virObjectLock(mgr->inactivePCIHostdevs);
if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs)))
goto cleanup;
/* Detaching devices from the host involves several steps; each /* Detaching devices from the host involves several steps; each
* of them is described at length below. * of them is described at length below.
* *
...@@ -912,9 +912,9 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr, ...@@ -912,9 +912,9 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
} }
cleanup: cleanup:
virObjectUnref(pcidevs);
virObjectUnlock(mgr->activePCIHostdevs); virObjectUnlock(mgr->activePCIHostdevs);
virObjectUnlock(mgr->inactivePCIHostdevs); virObjectUnlock(mgr->inactivePCIHostdevs);
virObjectUnref(pcidevs);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册