From: Tim Wiederhake Date: Wed, 7 Apr 2021 11:48:41 +0000 (+0200) Subject: conf: Use virTristateXXX in virPCIDeviceAddress X-Git-Tag: v7.3.0-rc1~200 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=876f994db1288db85860de842745472edd5f4c6e;p=thirdparty%2Flibvirt.git conf: Use virTristateXXX in virPCIDeviceAddress Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 1a0c126212..6a4b14cfda 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -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
'multifunction' attribute"), - multi); - return -1; - + if (multi) { + int value; + if ((value = virTristateSwitchTypeFromString(multi)) <= 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown value '%s' for
'multifunction' attribute"), + multi); + return -1; + } + addr->multi = value; } if (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(addr, true)) return -1; diff --git a/src/util/virpci.h b/src/util/virpci.h index 980c2f0646..1fa6c58d50 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -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. */