[libvirt PATCH v2 47/51] device_conf: Use virXMLPropTristateXXX in virPCIDeviceAddressParseXML

Tim Wiederhake twiederh at redhat.com
Fri Mar 19 13:41:01 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/conf/device_conf.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 714ac50762..8d0540bb02 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -214,7 +214,6 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
     g_autofree char *bus      = virXMLPropString(node, "bus");
     g_autofree char *slot     = virXMLPropString(node, "slot");
     g_autofree char *function = virXMLPropString(node, "function");
-    g_autofree char *multi    = virXMLPropString(node, "multifunction");
 
     memset(addr, 0, sizeof(*addr));
 
@@ -246,14 +245,9 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
         return -1;
     }
 
-    if (multi &&
-        ((addr->multi = virTristateSwitchTypeFromString(multi)) <= 0)) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Unknown value '%s' for <address> 'multifunction' attribute"),
-                       multi);
+    if (virXMLPropTristateSwitch(node, "multifunction", false, &addr->multi) < 0)
         return -1;
 
-    }
     if (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(addr, true))
         return -1;
 
-- 
2.26.2




More information about the libvir-list mailing list