render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
edecca
From fd6fae19231031f3feb83c854efdf2f1abfa7847 Mon Sep 17 00:00:00 2001
edecca
Message-Id: <fd6fae19231031f3feb83c854efdf2f1abfa7847@dist-git>
edecca
From: Erik Skultety <eskultet@redhat.com>
edecca
Date: Thu, 19 Jul 2018 15:04:01 +0200
edecca
Subject: [PATCH] conf: Replace 'error' with 'cleanup' in
edecca
 virDomainHostdevDefParseXMLSubsys
edecca
MIME-Version: 1.0
edecca
Content-Type: text/plain; charset=UTF-8
edecca
Content-Transfer-Encoding: 8bit
edecca
edecca
The exit path is the same for both success and failure, so the label
edecca
should be called cleanup.
edecca
edecca
Signed-off-by: Erik Skultety <eskultet@redhat.com>
edecca
Reviewed-by: Ján Tomko <jtomko@redhat.com>
edecca
(cherry picked from commit f1f6f4858260a77416ed5e0c86c4e0614aaf0a5e)
edecca
edecca
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
edecca
Signed-off-by: Erik Skultety <eskultet@redhat.com>
edecca
Reviewed-by: Ján Tomko <jtomko@redhat.com>
edecca
---
edecca
 src/conf/domain_conf.c | 38 +++++++++++++++++++-------------------
edecca
 1 file changed, 19 insertions(+), 19 deletions(-)
edecca
edecca
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
edecca
index 08654ab41d..72086f9e86 100644
edecca
--- a/src/conf/domain_conf.c
edecca
+++ b/src/conf/domain_conf.c
edecca
@@ -7690,18 +7690,18 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
edecca
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
edecca
                            _("unknown host device source address type '%s'"),
edecca
                            type);
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         }
edecca
     } else {
edecca
         virReportError(VIR_ERR_XML_ERROR,
edecca
                        "%s", _("missing source address type"));
edecca
-        goto error;
edecca
+        goto cleanup;
edecca
     }
edecca
 
edecca
     if (!(sourcenode = virXPathNode("./source", ctxt))) {
edecca
         virReportError(VIR_ERR_XML_ERROR, "%s",
edecca
                        _("Missing <source> element in hostdev device"));
edecca
-        goto error;
edecca
+        goto cleanup;
edecca
     }
edecca
 
edecca
     if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB &&
edecca
@@ -7709,20 +7709,20 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
edecca
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
edecca
                        _("Setting startupPolicy is only allowed for USB"
edecca
                          " devices"));
edecca
-        goto error;
edecca
+        goto cleanup;
edecca
     }
edecca
 
edecca
     if (sgio) {
edecca
         if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) {
edecca
             virReportError(VIR_ERR_XML_ERROR, "%s",
edecca
                            _("sgio is only supported for scsi host device"));
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         }
edecca
 
edecca
         if ((scsisrc->sgio = virDomainDeviceSGIOTypeFromString(sgio)) <= 0) {
edecca
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
edecca
                            _("unknown sgio mode '%s'"), sgio);
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         }
edecca
     }
edecca
 
edecca
@@ -7730,14 +7730,14 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
edecca
         if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) {
edecca
             virReportError(VIR_ERR_XML_ERROR, "%s",
edecca
                            _("rawio is only supported for scsi host device"));
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         }
edecca
 
edecca
         if ((scsisrc->rawio = virTristateBoolTypeFromString(rawio)) <= 0) {
edecca
             virReportError(VIR_ERR_XML_ERROR,
edecca
                            _("unknown hostdev rawio setting '%s'"),
edecca
                            rawio);
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         }
edecca
     }
edecca
 
edecca
@@ -7746,28 +7746,28 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
edecca
             virReportError(VIR_ERR_XML_ERROR, "%s",
edecca
                            _("'model' attribute in <hostdev> is only supported "
edecca
                              "when type='mdev'"));
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         }
edecca
     } else {
edecca
         if (!model) {
edecca
             virReportError(VIR_ERR_XML_ERROR, "%s",
edecca
                            _("Missing 'model' attribute in mediated device's "
edecca
                              "<hostdev> element"));
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         }
edecca
 
edecca
         if ((mdevsrc->model = virMediatedDeviceModelTypeFromString(model)) < 0) {
edecca
             virReportError(VIR_ERR_XML_ERROR,
edecca
                            _("unknown hostdev model '%s'"),
edecca
                            model);
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         }
edecca
     }
edecca
 
edecca
     switch (def->source.subsys.type) {
edecca
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
edecca
         if (virDomainHostdevSubsysPCIDefParseXML(sourcenode, def, flags) < 0)
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
 
edecca
         backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT;
edecca
         if ((backendStr = virXPathString("string(./driver/@name)", ctxt)) &&
edecca
@@ -7776,7 +7776,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
edecca
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
edecca
                            _("Unknown PCI device <driver name='%s'/> "
edecca
                              "has been specified"), backendStr);
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         }
edecca
         pcisrc->backend = backend;
edecca
 
edecca
@@ -7784,32 +7784,32 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
edecca
 
edecca
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
edecca
         if (virDomainHostdevSubsysUSBDefParseXML(sourcenode, def) < 0)
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         break;
edecca
 
edecca
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
edecca
         if (virDomainHostdevSubsysSCSIDefParseXML(sourcenode, scsisrc, ctxt) < 0)
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         break;
edecca
 
edecca
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
edecca
         if (virDomainHostdevSubsysSCSIVHostDefParseXML(sourcenode, def) < 0)
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         break;
edecca
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
edecca
         if (virDomainHostdevSubsysMediatedDevDefParseXML(def, ctxt) < 0)
edecca
-            goto error;
edecca
+            goto cleanup;
edecca
         break;
edecca
 
edecca
     default:
edecca
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
edecca
                        _("address type='%s' not supported in hostdev interfaces"),
edecca
                        virDomainHostdevSubsysTypeToString(def->source.subsys.type));
edecca
-        goto error;
edecca
+        goto cleanup;
edecca
     }
edecca
 
edecca
     ret = 0;
edecca
- error:
edecca
+ cleanup:
edecca
     VIR_FREE(managed);
edecca
     VIR_FREE(sgio);
edecca
     VIR_FREE(rawio);
edecca
-- 
edecca
2.18.0
edecca