mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
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);
|
virObjectUnref(pcidevs);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (virPCIDeviceListAdd(pcidevs, pci) < 0) {
|
|
||||||
virPCIDeviceFree(pci);
|
|
||||||
virObjectUnref(pcidevs);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
virPCIDeviceSetManaged(pci, hostdev->managed);
|
virPCIDeviceSetManaged(pci, hostdev->managed);
|
||||||
|
|
||||||
@ -254,6 +249,12 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
|
|||||||
virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_XEN);
|
virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_XEN);
|
||||||
else
|
else
|
||||||
virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_KVM);
|
virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_KVM);
|
||||||
|
|
||||||
|
if (virPCIDeviceListAdd(pcidevs, pci) < 0) {
|
||||||
|
virPCIDeviceFree(pci);
|
||||||
|
virObjectUnref(pcidevs);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pcidevs;
|
return pcidevs;
|
||||||
|
Loading…
Reference in New Issue
Block a user