[PATCH 3/6] virPCIGetVirtualFunctionIndex: Refactor cleanup

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

 



The 'ret' variable and 'out' label can be removed.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/util/virpci.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/util/virpci.c b/src/util/virpci.c
index 2afbf40af3..7059b29ec3 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -2409,31 +2409,28 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_device_link,
                               const char *vf_sysfs_device_link,
                               int *vf_index)
 {
-    int ret = -1;
     size_t i;
     g_autofree virPCIDeviceAddress *vf_bdf = NULL;
     g_autoptr(virPCIVirtualFunctionList) virt_fns = NULL;

     if (!(vf_bdf = virPCIGetDeviceAddressFromSysfsLink(vf_sysfs_device_link)))
-        return ret;
+        return -1;

     if (virPCIGetVirtualFunctions(pf_sysfs_device_link, &virt_fns) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Error getting physical function's '%s' "
                          "virtual_functions"), pf_sysfs_device_link);
-        goto out;
+        return -1;
     }

     for (i = 0; i < virt_fns->nfunctions; i++) {
         if (virPCIDeviceAddressEqual(vf_bdf, virt_fns->functions[i].addr)) {
             *vf_index = i;
-            ret = 0;
-            break;
+            return 0;
         }
     }

- out:
-    return ret;
+    return -1;
 }

 /*
-- 
2.31.1




[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