Instead of setting the flag before parsing the PCI address, set
it afterwards. This ensure we can never end up in a situation
where the flag has been set but pci_dev.physical_function has
not been filled in.
if (VIR_ALLOC(data->pci_dev.physical_function) < 0)
goto out;
- data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION;
-
if (!address) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Missing address in 'phys_function' capability"));
if (virPCIDeviceAddressParseXML(address,
data->pci_dev.physical_function) < 0)
goto out;
+
+ data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION;
} else if (STREQ(type, "virt_functions")) {
int naddresses;