[libvirt] [PATCH] storage: logical: drop useless if

Roman Bogorodskiy bogorodskiy at gmail.com
Mon Jul 21 17:39:33 UTC 2014


virStorageBackendLogicalCreateVol contains a piece like:

    if (vol->target.path != NULL) {
        /* A target path passed to CreateVol has no meaning */
        VIR_FREE(vol->target.path);
    }

The 'if' is useless here, but 'syntax-check' doesn't catch that
because of the comment, so drop the 'if'.
---
 src/storage/storage_backend_logical.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index ed62c2f..4959985 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -742,10 +742,8 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
 
     vol->type = VIR_STORAGE_VOL_BLOCK;
 
-    if (vol->target.path != NULL) {
-        /* A target path passed to CreateVol has no meaning */
-        VIR_FREE(vol->target.path);
-    }
+    /* A target path passed to CreateVol has no meaning */
+    VIR_FREE(vol->target.path);
 
     if (virAsprintf(&vol->target.path, "%s/%s",
                     pool->def->target.path,
-- 
1.9.0




More information about the libvir-list mailing list