]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Use virTristateXXX in virPCIDeviceAddress
authorTim Wiederhake <twiederh@redhat.com>
Wed, 7 Apr 2021 11:48:41 +0000 (13:48 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 16 Apr 2021 07:48:42 +0000 (09:48 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/device_conf.c
src/util/virpci.h

index 1a0c12621243d6b6bfb961ee6be902617d40fb6a..6a4b14cfdae6c5158adf57eb27507662f2ad6064 100644 (file)
@@ -246,13 +246,15 @@ 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);
-        return -1;
-
+    if (multi) {
+        int value;
+        if ((value = virTristateSwitchTypeFromString(multi)) <= 0) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("Unknown value '%s' for <address> 'multifunction' attribute"),
+                           multi);
+            return -1;
+        }
+        addr->multi = value;
     }
     if (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(addr, true))
         return -1;
index 980c2f0646dc2066d16b411192c4e54a6984d3f9..1fa6c58d50c4a6bbcdc71d74d5ec06c71e6705a4 100644 (file)
@@ -61,7 +61,7 @@ struct _virPCIDeviceAddress {
     unsigned int bus;
     unsigned int slot;
     unsigned int function;
-    int multi; /* virTristateSwitch */
+    virTristateSwitch multi;
     int extFlags; /* enum virPCIDeviceAddressExtensionFlags */
     virZPCIDeviceAddress zpci;
     /* Don't forget to update virPCIDeviceAddressCopy if needed. */