Blame SOURCES/libvirt-conf-Replace-error-with-cleanup-in-virDomainHostdevDefParseXMLSubsys.patch

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