storage: scsi: invert logic in createVport

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@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Ján Tomko 2020-09-24 20:55:24 +02:00
parent 6e9a2351d4
commit ff146d0953

View File

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