mirror of https://gitee.com/openkylin/libvirt.git
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:
parent
fd57b7bfe1
commit
d3dcc9ce2b
|
@ -153,8 +153,8 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
|
|||
|
||||
if (STREQ(phase, "none"))
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4286,9 +4286,10 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
|
|||
rc = qemuMigrationSrcWaitForCompletion(driver, vm,
|
||||
QEMU_ASYNC_JOB_MIGRATION_OUT,
|
||||
dconn, waitFlags);
|
||||
if (rc == -2) {
|
||||
if (rc == -2)
|
||||
goto error;
|
||||
} else if (rc == -1) {
|
||||
|
||||
if (rc == -1) {
|
||||
/* QEMU reported failed migration, nothing to cancel anymore */
|
||||
cancel = false;
|
||||
goto error;
|
||||
|
@ -4326,9 +4327,10 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
|
|||
rc = qemuMigrationSrcWaitForCompletion(driver, vm,
|
||||
QEMU_ASYNC_JOB_MIGRATION_OUT,
|
||||
dconn, waitFlags);
|
||||
if (rc == -2) {
|
||||
if (rc == -2)
|
||||
goto error;
|
||||
} else if (rc == -1) {
|
||||
|
||||
if (rc == -1) {
|
||||
/* QEMU reported failed migration, nothing to cancel anymore */
|
||||
cancel = false;
|
||||
goto error;
|
||||
|
@ -6189,8 +6191,8 @@ qemuMigrationDstErrorInit(virQEMUDriver *driver)
|
|||
driver->migrationErrors = virHashAtomicNew(qemuMigrationDstErrorFree);
|
||||
if (driver->migrationErrors)
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8700,8 +8700,8 @@ qemuProcessRefreshBlockjobs(virQEMUDriver *driver,
|
|||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
|
||||
return qemuBlockJobRefreshJobs(driver, vm);
|
||||
else
|
||||
return qemuProcessRefreshLegacyBlockjobs(driver, vm);
|
||||
|
||||
return qemuProcessRefreshLegacyBlockjobs(driver, vm);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -583,13 +583,13 @@ qemuSnapshotPrepareDiskExternal(virDomainObj *vm,
|
|||
_("missing existing file for disk %s: %s"),
|
||||
snapdisk->name, snapdisk->src->path);
|
||||
return -1;
|
||||
} else {
|
||||
if (snapdisk->src->type == VIR_STORAGE_TYPE_BLOCK) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||
_("block device snapshot target '%s' doesn't exist"),
|
||||
snapdisk->src->path);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (snapdisk->src->type == VIR_STORAGE_TYPE_BLOCK) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||
_("block device snapshot target '%s' doesn't exist"),
|
||||
snapdisk->src->path);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
/* at this point VIR_STORAGE_TYPE_DIR was already rejected */
|
||||
|
|
Loading…
Reference in New Issue