[libvirt PATCH 6/7] storage: scsi: invert logic in createVport

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check whether the alloc result is negative (which is
cannot happen with current code) to reduce churn in
the following commit.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/storage/storage_backend_scsi.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index e528d7622c..b5866935d1 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -329,16 +329,17 @@ createVport(virStoragePoolDefPtr def,
      * retry logic set to true. If the thread isn't created, then no big
      * deal since it's still possible to refresh the pool later.
      */
-    if (VIR_ALLOC(cbdata) == 0) {
-        memcpy(cbdata->pool_uuid, def->uuid, VIR_UUID_BUFLEN);
-        cbdata->fchost_name = g_steal_pointer(&name);
+    if (VIR_ALLOC(cbdata) < 0)
+        return -1;
 
-        if (virThreadCreateFull(&thread, false, virStoragePoolFCRefreshThread,
-                                "scsi-refresh", false, cbdata) < 0) {
-            /* Oh well - at least someone can still refresh afterwards */
-            VIR_DEBUG("Failed to create FC Pool Refresh Thread");
-            virStoragePoolFCRefreshDataFree(cbdata);
-        }
+    memcpy(cbdata->pool_uuid, def->uuid, VIR_UUID_BUFLEN);
+    cbdata->fchost_name = g_steal_pointer(&name);
+
+    if (virThreadCreateFull(&thread, false, virStoragePoolFCRefreshThread,
+                            "scsi-refresh", false, cbdata) < 0) {
+        /* Oh well - at least someone can still refresh afterwards */
+        VIR_DEBUG("Failed to create FC Pool Refresh Thread");
+        virStoragePoolFCRefreshDataFree(cbdata);
     }
 
     return 0;
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux