]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
udevConnectListAllInterfaces: initialize ret
authorJán Tomko <jtomko@redhat.com>
Fri, 20 Nov 2020 13:05:54 +0000 (14:05 +0100)
committerJán Tomko <jtomko@redhat.com>
Tue, 1 Dec 2020 16:22:09 +0000 (17:22 +0100)
Currently, ret is only used in the 'cleanup' section
and initialized right before the jump.

Switch to the customary initialization to -1 and only
leave in the 'ret = 0' statement on an empty list.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/interface/interface_backend_udev.c

index ce007fd29e68e4d889fe3cbb04388336c7a3fbeb..31246dde74482e206f52a67c3962917b65349fc0 100644 (file)
@@ -303,7 +303,7 @@ udevConnectListAllInterfaces(virConnectPtr conn,
     int tmp_count;
     int count = 0;
     int status = 0;
-    int ret;
+    int ret = -1;
 
     virCheckFlags(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE, -1);
 
@@ -320,7 +320,6 @@ udevConnectListAllInterfaces(virConnectPtr conn,
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("failed to get list of %s interfaces on host"),
                        virUdevStatusString(status));
-        ret = -1;
         goto cleanup;
     }