[libvirt] [PATCH v1 10/21] qemu: remove unneeded cleanup labels

Ján Tomko jtomko at redhat.com
Tue Nov 12 16:40:03 UTC 2019


On Mon, Oct 21, 2019 at 03:19:00PM -0300, Daniel Henrique Barboza wrote:
>Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
>---
> src/qemu/qemu_cgroup.c         |  15 ++--
> src/qemu/qemu_domain.c         |  92 ++++++++--------------
> src/qemu/qemu_domain_address.c |  31 +++-----
> src/qemu/qemu_driver.c         | 140 ++++++++++++---------------------
> src/qemu/qemu_hotplug.c        |  45 +++++------
> src/qemu/qemu_interface.c      |  26 +++---
> src/qemu/qemu_migration.c      |  38 +++------
> src/qemu/qemu_process.c        |  77 ++++++------------
> src/qemu/qemu_tpm.c            |  20 ++---
> 9 files changed, 172 insertions(+), 312 deletions(-)
>
>@@ -3739,19 +3735,18 @@ qemuDumpToFd(virQEMUDriverPtr driver,
>                            dumpformat);
>             ret = -1;
>             ignore_value(qemuDomainObjExitMonitor(driver, vm));
>-            goto cleanup;
>+            return ret;

ret is set to -1 just a few lines above, so returning -1 here is fine.

>         }
>     }
>
>     ret = qemuMonitorDumpToFd(priv->mon, fd, dumpformat, detach);
>
>     if ((qemuDomainObjExitMonitor(driver, vm) < 0) || ret < 0)
>-        goto cleanup;
>+        return ret;

qemuMonitorDumpToFd returns either 0 or -1 so returning -1 here is also
fine.

>
>     if (detach)
>         ret = qemuDumpWaitForCompletion(vm);
>
>- cleanup:
>     return ret;
> }
>
>@@ -17450,18 +17423,17 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
>         ret = qemuMonitorDrivePivot(priv->mon, job->name);
>     if (qemuDomainObjExitMonitor(driver, vm) < 0) {
>         ret = -1;
>-        goto cleanup;
>+        return ret;

return -1;

>     }
>
>     /* The pivot failed. The block job in QEMU remains in the synchronised state */
>     if (ret < 0)
>-        goto cleanup;
>+        return ret;

return -1;

>
>     if (disk && disk->mirror)
>         disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT;
>     job->state = QEMU_BLOCKJOB_STATE_PIVOTING;
>
>- cleanup:
>     return ret;
> }
>
>@@ -4037,7 +4031,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
>             virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
>                            _("cannot change the type of listen address "
>                              "on '%s' graphics"), type);
>-            goto cleanup;
>+            return ret;

No need to use ret in this function

>         }
>
>         switch (newlisten->type) {

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20191112/0a00c1e6/attachment-0001.sig>


More information about the libvir-list mailing list