virSecurityLabelDefParseXML: Remove pointless 'error' label

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-11-22 16:42:21 +01:00
parent 1e67130b63
commit 712a04bca1

View File

@ -7808,7 +7808,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
VIR_SECURITY_MODEL_BUFLEN - 1); VIR_SECURITY_MODEL_BUFLEN - 1);
if (!(seclabel = virSecurityLabelDefNew(model))) if (!(seclabel = virSecurityLabelDefNew(model)))
goto error; return NULL;
/* set default value */ /* set default value */
seclabel->type = VIR_DOMAIN_SECLABEL_DYNAMIC; seclabel->type = VIR_DOMAIN_SECLABEL_DYNAMIC;
@ -7817,7 +7817,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
virDomainSeclabelTypeFromString, virDomainSeclabelTypeFromString,
VIR_XML_PROP_NONZERO, VIR_XML_PROP_NONZERO,
&seclabel->type) < 0) &seclabel->type) < 0)
goto error; return NULL;
if (seclabel->type == VIR_DOMAIN_SECLABEL_STATIC || if (seclabel->type == VIR_DOMAIN_SECLABEL_STATIC ||
seclabel->type == VIR_DOMAIN_SECLABEL_NONE) seclabel->type == VIR_DOMAIN_SECLABEL_NONE)
@ -7827,7 +7827,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
if (virStringParseYesNo(relabel, &seclabel->relabel) < 0) { if (virStringParseYesNo(relabel, &seclabel->relabel) < 0) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
_("invalid security relabel value '%s'"), relabel); _("invalid security relabel value '%s'"), relabel);
goto error; return NULL;
} }
} }
@ -7835,13 +7835,13 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
!seclabel->relabel) { !seclabel->relabel) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("dynamic label type must use resource relabeling")); "%s", _("dynamic label type must use resource relabeling"));
goto error; return NULL;
} }
if (seclabel->type == VIR_DOMAIN_SECLABEL_NONE && if (seclabel->type == VIR_DOMAIN_SECLABEL_NONE &&
seclabel->relabel) { seclabel->relabel) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("resource relabeling is not compatible with 'none' label type")); "%s", _("resource relabeling is not compatible with 'none' label type"));
goto error; return NULL;
} }
/* For the model 'none' none of the following labels is going to be /* For the model 'none' none of the following labels is going to be
@ -7857,7 +7857,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported type='%s' to model 'none'"), _("unsupported type='%s' to model 'none'"),
virDomainSeclabelTypeToString(seclabel->type)); virDomainSeclabelTypeToString(seclabel->type));
goto error; return NULL;
} }
/* combination of relabel='yes' and type='static' /* combination of relabel='yes' and type='static'
* is checked a few lines above. */ * is checked a few lines above. */
@ -7876,7 +7876,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
if (!seclabel->label) { if (!seclabel->label) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
"%s", _("security label is missing")); "%s", _("security label is missing"));
goto error; return NULL;
} }
} }
@ -7889,7 +7889,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
if (!seclabel->imagelabel) { if (!seclabel->imagelabel) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
"%s", _("security imagelabel is missing")); "%s", _("security imagelabel is missing"));
goto error; return NULL;
} }
} }
@ -7900,9 +7900,6 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
} }
return g_steal_pointer(&seclabel); return g_steal_pointer(&seclabel);
error:
return NULL;
} }
static int static int