1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemu: remove unnecessary else branches after return / goto

I think the code looks cleaner without else branches.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Kristina Hanicova 2022-03-24 15:34:07 +01:00 committed by Ján Tomko
parent fd57b7bfe1
commit d3dcc9ce2b
4 changed files with 19 additions and 17 deletions

View File

@ -153,8 +153,8 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
if (STREQ(phase, "none")) if (STREQ(phase, "none"))
return 0; return 0;
else
return -1; return -1;
} }

View File

@ -4286,9 +4286,10 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
rc = qemuMigrationSrcWaitForCompletion(driver, vm, rc = qemuMigrationSrcWaitForCompletion(driver, vm,
QEMU_ASYNC_JOB_MIGRATION_OUT, QEMU_ASYNC_JOB_MIGRATION_OUT,
dconn, waitFlags); dconn, waitFlags);
if (rc == -2) { if (rc == -2)
goto error; goto error;
} else if (rc == -1) {
if (rc == -1) {
/* QEMU reported failed migration, nothing to cancel anymore */ /* QEMU reported failed migration, nothing to cancel anymore */
cancel = false; cancel = false;
goto error; goto error;
@ -4326,9 +4327,10 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
rc = qemuMigrationSrcWaitForCompletion(driver, vm, rc = qemuMigrationSrcWaitForCompletion(driver, vm,
QEMU_ASYNC_JOB_MIGRATION_OUT, QEMU_ASYNC_JOB_MIGRATION_OUT,
dconn, waitFlags); dconn, waitFlags);
if (rc == -2) { if (rc == -2)
goto error; goto error;
} else if (rc == -1) {
if (rc == -1) {
/* QEMU reported failed migration, nothing to cancel anymore */ /* QEMU reported failed migration, nothing to cancel anymore */
cancel = false; cancel = false;
goto error; goto error;
@ -6189,8 +6191,8 @@ qemuMigrationDstErrorInit(virQEMUDriver *driver)
driver->migrationErrors = virHashAtomicNew(qemuMigrationDstErrorFree); driver->migrationErrors = virHashAtomicNew(qemuMigrationDstErrorFree);
if (driver->migrationErrors) if (driver->migrationErrors)
return 0; return 0;
else
return -1; return -1;
} }
/** /**

View File

@ -8700,8 +8700,8 @@ qemuProcessRefreshBlockjobs(virQEMUDriver *driver,
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
return qemuBlockJobRefreshJobs(driver, vm); return qemuBlockJobRefreshJobs(driver, vm);
else
return qemuProcessRefreshLegacyBlockjobs(driver, vm); return qemuProcessRefreshLegacyBlockjobs(driver, vm);
} }

View File

@ -583,13 +583,13 @@ qemuSnapshotPrepareDiskExternal(virDomainObj *vm,
_("missing existing file for disk %s: %s"), _("missing existing file for disk %s: %s"),
snapdisk->name, snapdisk->src->path); snapdisk->name, snapdisk->src->path);
return -1; return -1;
} else { }
if (snapdisk->src->type == VIR_STORAGE_TYPE_BLOCK) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, if (snapdisk->src->type == VIR_STORAGE_TYPE_BLOCK) {
_("block device snapshot target '%s' doesn't exist"), virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
snapdisk->src->path); _("block device snapshot target '%s' doesn't exist"),
return -1; snapdisk->src->path);
} return -1;
} }
} else { } else {
/* at this point VIR_STORAGE_TYPE_DIR was already rejected */ /* at this point VIR_STORAGE_TYPE_DIR was already rejected */