[libvirt] [PATCH v2 22/29] qemu: Remove cleanup in qemuDomainObjPrivateXMLParseJobNBDSource

Peter Krempa pkrempa at redhat.com
Fri Mar 22 18:00:58 UTC 2019


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_domain.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9323421e49..c7454ce821 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2717,42 +2717,39 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node,
     qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
     VIR_AUTOFREE(char *) format = NULL;
     VIR_AUTOFREE(char *) type = NULL;
-    int ret = -1;
     VIR_AUTOUNREF(virStorageSourcePtr) migrSource = NULL;
     xmlNodePtr sourceNode;

     ctxt->node = node;

-    if (!(ctxt->node = virXPathNode("./migrationSource", ctxt))) {
-        ret = 0;
-        goto cleanup;
-    }
+    if (!(ctxt->node = virXPathNode("./migrationSource", ctxt)))
+        return 0;

     if (!(migrSource = virStorageSourceNew()))
-        goto cleanup;
+        return -1;

     if (!(type = virXMLPropString(ctxt->node, "type"))) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("missing storage source type"));
-        goto cleanup;
+        return -1;
     }

     if (!(format = virXMLPropString(ctxt->node, "format"))) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("missing storage source format"));
-        goto cleanup;
+        return -1;
     }

     if ((migrSource->type = virStorageTypeFromString(type)) <= 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unknown storage source type '%s'"), type);
-        goto cleanup;
+        return -1;
     }

     if ((migrSource->format = virStorageFileFormatTypeFromString(format)) <= 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unknown storage source format '%s'"), format);
-        goto cleanup;
+        return -1;
     }

     if ((sourceNode = virXPathNode("./source", ctxt)))
@@ -2760,17 +2757,14 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node,

     if (virDomainStorageSourceParse(ctxt->node, ctxt, migrSource,
                                     VIR_DOMAIN_DEF_PARSE_STATUS, NULL) < 0)
-        goto cleanup;
+        return -1;

     if ((ctxt->node = virXPathNode("./privateData", ctxt)) &&
         qemuStorageSourcePrivateDataParse(ctxt, migrSource) < 0)
-        goto cleanup;
+        return -1;

     VIR_STEAL_PTR(diskPriv->migrSource, migrSource);
-    ret = 0;
-
- cleanup:
-    return ret;
+    return 0;
 }


-- 
2.20.1




More information about the libvir-list mailing list