]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virPCIGetVirtualFunctionIndex: Refactor cleanup
authorPeter Krempa <pkrempa@redhat.com>
Wed, 4 Aug 2021 14:35:31 +0000 (16:35 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 9 Aug 2021 08:09:00 +0000 (10:09 +0200)
The 'ret' variable and 'out' label can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virpci.c

index 2afbf40af3408418f79d88528fe2771ef43cf7ff..7059b29ec36b8fbd8ac503e0be871b68309a516c 100644 (file)
@@ -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;
 }
 
 /*