From: Michal Privoznik Date: Mon, 18 Jul 2022 07:58:38 +0000 (+0200) Subject: conf: Drop needless setting of VIR_DOMAIN_TPM_VERSION_DEFAULT X-Git-Tag: v8.7.0-rc1~248 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=598ffbdd41260fda474bea0370f11f7dec9f72bb;p=thirdparty%2Flibvirt.git conf: Drop needless setting of VIR_DOMAIN_TPM_VERSION_DEFAULT In previous commit the VIR_DOMAIN_TPM_VERSION_DEFAULT value was made just an alias to value of 0. And since all newly allocated memory is zeroed out (due to use of g_new0()), the def->version inside of virDomainTPMDefParseXML() is also 0 and thus there is no need to set it explicitly. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bc8dedf817..7509fcf88e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10414,15 +10414,12 @@ virDomainTPMDefParseXML(virDomainXMLOption *xmlopt, } version = virXMLPropString(backends[0], "version"); - if (!version) { - def->version = VIR_DOMAIN_TPM_VERSION_DEFAULT; - } else { - if ((def->version = virDomainTPMVersionTypeFromString(version)) <= 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported TPM version '%s'"), - version); - goto error; - } + if (version && + (def->version = virDomainTPMVersionTypeFromString(version)) <= 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported TPM version '%s'"), + version); + goto error; } switch (def->type) {