render / rpms / libvirt

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