[PATCH 7/9] util: remove unneeded cleanup:/ret in virpci.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These were nops once enough cleanup was g_auto'd.

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
 src/util/virpci.c | 35 +++++++++++++----------------------
 1 file changed, 13 insertions(+), 22 deletions(-)

diff --git a/src/util/virpci.c b/src/util/virpci.c
index c7ee259e29..855872031e 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1849,7 +1849,6 @@ typedef virPCIDeviceAddressList *virPCIDeviceAddressListPtr;
 static int
 virPCIGetIOMMUGroupAddressesAddOne(virPCIDeviceAddressPtr newDevAddr, void *opaque)
 {
-    int ret = -1;
     virPCIDeviceAddressListPtr addrList = opaque;
     g_autofree virPCIDeviceAddressPtr copyAddr = NULL;
 
@@ -1860,11 +1859,9 @@ virPCIGetIOMMUGroupAddressesAddOne(virPCIDeviceAddressPtr newDevAddr, void *opaq
 
     if (VIR_APPEND_ELEMENT(*addrList->iommuGroupDevices,
                            *addrList->nIommuGroupDevices, copyAddr) < 0)
-        goto cleanup;
+        return -1;
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
@@ -2243,7 +2240,6 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
                           size_t *num_virtual_functions,
                           unsigned int *max_virtual_functions)
 {
-    int ret = -1;
     size_t i;
     g_autofree char *totalvfs_file = NULL;
     g_autofree char *totalvfs_str = NULL;
@@ -2290,16 +2286,14 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
 
     VIR_DEBUG("Found %zu virtual functions for %s",
               *num_virtual_functions, sysfs_path);
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 
  error:
     for (i = 0; i < *num_virtual_functions; i++)
         VIR_FREE((*virtual_functions)[i]);
     VIR_FREE(*virtual_functions);
     *num_virtual_functions = 0;
-    goto cleanup;
+    return -1;
 }
 
 
@@ -2489,22 +2483,21 @@ virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
     g_autofree char *pf_sysfs_device_path = NULL;
     g_autofree char *vfname = NULL;
     g_autofree char *vfPhysPortID = NULL;
-    int ret = -1;
 
     if (virPCIGetPhysicalFunction(vf_sysfs_device_path, &pf_config_address) < 0)
-        goto cleanup;
+        return -1;
 
     if (!pf_config_address)
-        goto cleanup;
+        return -1;
 
     if (virPCIDeviceAddressGetSysfsFile(pf_config_address,
                                         &pf_sysfs_device_path) < 0) {
-        goto cleanup;
+        return -1;
     }
 
     if (virPCIGetVirtualFunctionIndex(pf_sysfs_device_path,
                                       vf_sysfs_device_path, vf_index) < 0) {
-        goto cleanup;
+        return -1;
     }
 
     /* If the caller hasn't asked for a specific pfNetDevIdx, and VF
@@ -2516,18 +2509,18 @@ virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
      */
     if (pfNetDevIdx == -1) {
         if (virPCIGetNetName(vf_sysfs_device_path, 0, NULL, &vfname) < 0)
-            goto cleanup;
+            return -1;
 
         if (vfname) {
             if (virNetDevGetPhysPortID(vfname, &vfPhysPortID) < 0)
-                goto cleanup;
+                return -1;
         }
         pfNetDevIdx = 0;
     }
 
     if (virPCIGetNetName(pf_sysfs_device_path,
                          pfNetDevIdx, vfPhysPortID, pfname) < 0) {
-        goto cleanup;
+        return -1;
     }
 
     if (!*pfname) {
@@ -2537,12 +2530,10 @@ virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("The PF device for VF %s has no network device name"),
                        vf_sysfs_device_path);
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux