]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: fix improper assignment of return value in virHostdevReadNetConfig()
authorLaine Stump <laine@laine.org>
Sun, 13 Aug 2017 15:19:27 +0000 (11:19 -0400)
committerLaine Stump <laine@laine.org>
Mon, 14 Aug 2017 03:07:13 +0000 (23:07 -0400)
Commit 9a94af6d restructured virHostdevReadNetConfig() so that it
would manually set ret = 0 after successfully reading the device's
config, but Coverity pointed out that "ret = 0" was erroneously placed
outside of an "else" clause, meaning that the the value of ret set in
the "if" clause was unnecessarily and incorrectly overwritten.

This patch moves ret = 0 into the else clause, which should silence
Coverity.

src/util/virhostdev.c

index cca9d81a4c7a010e21d87116b239c72f51076c2f..a12224c58f28a2240424e4a50bca7e0114a07a55 100644 (file)
@@ -641,9 +641,9 @@ virHostdevRestoreNetConfig(virDomainHostdevDefPtr hostdev,
 
         ignore_value(virNetDevSetNetConfig(linkdev, vf,
                                            adminMAC, vlan, MAC, true));
+        ret = 0;
     }
 
-    ret = 0;
  cleanup:
     VIR_FREE(linkdev);
     VIR_FREE(MAC);