[libvirt] [PATCH 11/24] hostdev: Remove redundant check

Andrea Bolognani abologna at redhat.com
Mon Mar 7 17:24:27 UTC 2016


If 'last_processed_hostdev_vf != -1' is false then, since the
loop counter 'i' starts at 0, 'i <= last_processed_hostdev_vf'
can't possibly be true and the loop body will never be executed.

Hence, the first check is completely redundant and can be safely
removed.
---
 src/util/virhostdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 098207e..f08502b 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -718,8 +718,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
     }
 
  resetvfnetconfig:
-    for (i = 0;
-         last_processed_hostdev_vf != -1 && i <= last_processed_hostdev_vf; i++)
+    for (i = 0; i <= last_processed_hostdev_vf; i++)
         virHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir, NULL);
 
  reattachdevs:
-- 
2.5.0




More information about the libvir-list mailing list