[libvirt] [PATCH 02/14] util: storagefile: Remove cleanup label from virStorageSourceParseBackingJSONiSCSI

Peter Krempa pkrempa at redhat.com
Fri Aug 16 10:39:23 UTC 2019


There is no cleanup code.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/virstoragefile.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 520f531088..8af45bfbd2 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -3263,7 +3263,6 @@ virStorageSourceParseBackingJSONiSCSI(virStorageSourcePtr src,
     const char *lun = virJSONValueObjectGetStringOrNumber(json, "lun");
     const char *uri;
     char *port;
-    int ret = -1;

     /* legacy URI based syntax passed via 'filename' option */
     if ((uri = virJSONValueObjectGetString(json, "filename")))
@@ -3277,14 +3276,14 @@ virStorageSourceParseBackingJSONiSCSI(virStorageSourcePtr src,
         lun = "0";

     if (VIR_ALLOC(src->hosts) < 0)
-        goto cleanup;
+        return -1;

     src->nhosts = 1;

     if (STRNEQ_NULLABLE(transport, "tcp")) {
         virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("only TCP transport is supported for iSCSI volumes"));
-        goto cleanup;
+        return -1;
     }

     src->hosts->transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
@@ -3292,33 +3291,30 @@ virStorageSourceParseBackingJSONiSCSI(virStorageSourcePtr src,
     if (!portal) {
         virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("missing 'portal' address in iSCSI backing definition"));
-        goto cleanup;
+        return -1;
     }

     if (!target) {
         virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("missing 'target' in iSCSI backing definition"));
-        goto cleanup;
+        return -1;
     }

     if (VIR_STRDUP(src->hosts->name, portal) < 0)
-        goto cleanup;
+        return -1;

     if ((port = strrchr(src->hosts->name, ':')) &&
         !strchr(port, ']')) {
         if (virStringParsePort(port + 1, &src->hosts->port) < 0)
-            goto cleanup;
+            return -1;

         *port = '\0';
     }

     if (virAsprintf(&src->path, "%s/%s", target, lun) < 0)
-        goto cleanup;
-
-    ret = 0;
+        return -1;

- cleanup:
-    return ret;
+    return 0;
 }


-- 
2.21.0




More information about the libvir-list mailing list