render / rpms / libvirt

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