mirror of https://gitee.com/openkylin/libvirt.git
virHostdevGetPCIHostDeviceList: Add @pci a bit later
This function is a good candidate for VIR_AUTOPTR() conversion. But this conversion will be easier if we only add @pci device onto @pcidevs list after it was all set up. This is no functional change. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7979066b69
commit
7cf2963017
|
@ -240,11 +240,6 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
|
|||
virObjectUnref(pcidevs);
|
||||
return NULL;
|
||||
}
|
||||
if (virPCIDeviceListAdd(pcidevs, pci) < 0) {
|
||||
virPCIDeviceFree(pci);
|
||||
virObjectUnref(pcidevs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virPCIDeviceSetManaged(pci, hostdev->managed);
|
||||
|
||||
|
@ -254,6 +249,12 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
|
|||
virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_XEN);
|
||||
else
|
||||
virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_KVM);
|
||||
|
||||
if (virPCIDeviceListAdd(pcidevs, pci) < 0) {
|
||||
virPCIDeviceFree(pci);
|
||||
virObjectUnref(pcidevs);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return pcidevs;
|
||||
|
|
Loading…
Reference in New Issue