qemu_migration.c: modernize qemuMigrationSrcPerformNative()

Use g_autoptr() and remove the unneeded 'cleanup' label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Daniel Henrique Barboza 2020-07-13 06:49:50 -03:00 committed by Michal Privoznik
parent b7d5277deb
commit 6f59ffb4c9

View File

@ -3844,7 +3844,7 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver,
qemuMigrationParamsPtr migParams) qemuMigrationParamsPtr migParams)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
virURIPtr uribits = NULL; g_autoptr(virURI) uribits = NULL;
int ret = -1; int ret = -1;
qemuMigrationSpec spec; qemuMigrationSpec spec;
@ -3862,7 +3862,7 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver,
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("missing scheme in migration URI: %s"), _("missing scheme in migration URI: %s"),
uri); uri);
goto cleanup; return -1;
} }
if (STREQ(uribits->scheme, "rdma")) { if (STREQ(uribits->scheme, "rdma")) {
@ -3870,13 +3870,13 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver,
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("outgoing RDMA migration is not supported " _("outgoing RDMA migration is not supported "
"with this QEMU binary")); "with this QEMU binary"));
goto cleanup; return -1;
} }
if (!virMemoryLimitIsSet(vm->def->mem.hard_limit)) { if (!virMemoryLimitIsSet(vm->def->mem.hard_limit)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s", virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot start RDMA migration with no memory hard " _("cannot start RDMA migration with no memory hard "
"limit set")); "limit set"));
goto cleanup; return -1;
} }
} }
@ -3900,9 +3900,6 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver,
if (spec.destType == MIGRATION_DEST_FD) if (spec.destType == MIGRATION_DEST_FD)
VIR_FORCE_CLOSE(spec.dest.fd.qemu); VIR_FORCE_CLOSE(spec.dest.fd.qemu);
cleanup:
virURIFree(uribits);
return ret; return ret;
} }