[PATCH 20/30] util: remove cleanup label

Ryan Gahagan rgahagan at cs.utexas.edu
Mon Nov 23 22:09:41 UTC 2020


From: Barrett Schonefeld <bschoney at utexas.edu>

- src/util/virvhba.c

Signed-off-by: Barrett Schonefeld <bschoney at utexas.edu>
---
 src/util/virvhba.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/util/virvhba.c b/src/util/virvhba.c
index a80145b8fd..e0a79344cc 100644
--- a/src/util/virvhba.c
+++ b/src/util/virvhba.c
@@ -121,10 +121,10 @@ virVHBAGetConfig(const char *sysfs_prefix,
                                  sysfs_prefix ? sysfs_prefix : SYSFS_FC_HOST_PATH, host, entry);
 
     if (!virFileExists(sysfs_path))
-        goto cleanup;
+        return result;
 
     if (virFileReadAll(sysfs_path, 1024, &buf) < 0)
-        goto cleanup;
+        return result;
 
     if ((p = strchr(buf, '\n')))
         *p = '\0';
@@ -136,7 +136,6 @@ virVHBAGetConfig(const char *sysfs_prefix,
 
     result = g_strdup(p);
 
- cleanup:
     return result;
 }
 
@@ -206,15 +205,13 @@ virVHBAFindVportHost(const char *sysfs_prefix)
         if ((strlen(max_vports) >= strlen(vports)) ||
             ((strlen(max_vports) == strlen(vports)) &&
              strcmp(max_vports, vports) > 0)) {
-            ret = g_strdup(entry->d_name);
-            goto cleanup;
+            return g_strdup(entry->d_name);
         }
 
         VIR_FREE(max_vports);
         VIR_FREE(vports);
     }
 
- cleanup:
     return ret;
 }
 
@@ -248,7 +245,7 @@ virVHBAManageVport(const int parent_host,
     default:
         virReportError(VIR_ERR_OPERATION_INVALID,
                        _("Invalid vport operation (%d)"), operation);
-        goto cleanup;
+        return ret;
     }
 
     operation_path = g_strdup_printf("%s/host%d/%s", SYSFS_FC_HOST_PATH,
@@ -264,7 +261,7 @@ virVHBAManageVport(const int parent_host,
                            _("vport operation '%s' is not supported "
                              "for host%d"),
                            operation_file, parent_host);
-            goto cleanup;
+            return ret;
         }
     }
 
@@ -284,7 +281,6 @@ virVHBAManageVport(const int parent_host,
                                "vport create/delete failed"),
                              vport_name, operation_path);
 
- cleanup:
     return ret;
 }
 
@@ -315,12 +311,11 @@ vhbaReadCompareWWN(const char *prefix,
     path = g_strdup_printf("%s/%s/%s", prefix, d_name, f_name);
 
     if (!virFileExists(path)) {
-        ret = 0;
-        goto cleanup;
+        return 0;
     }
 
     if (virFileReadAll(path, 1024, &buf) < 0)
-        goto cleanup;
+        return ret;
 
     if ((p = strchr(buf, '\n')))
         *p = '\0';
@@ -334,8 +329,6 @@ vhbaReadCompareWWN(const char *prefix,
     else
         ret = 1;
 
- cleanup:
-
     return ret;
 }
 
@@ -418,7 +411,7 @@ virVHBAGetHostByFabricWWN(const char *sysfs_prefix,
 
         if ((rc = vhbaReadCompareWWN(prefix, entry->d_name,
                                      "fabric_name", fabric_wwn)) < 0)
-            goto cleanup;
+            return ret;
 
         if (rc == 0)
             continue;
@@ -427,7 +420,6 @@ virVHBAGetHostByFabricWWN(const char *sysfs_prefix,
         break;
     }
 
- cleanup:
     return ret;
 }
 
-- 
2.29.0




More information about the libvir-list mailing list