提交 06160f67 编写于 作者: J Ján Tomko

qemu: eliminate ret variable in qemuExtTPMStartEmulator

Now that the cleanup section is empty, eliminate the cleanup
label as well as the 'ret' variable.
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
上级 ebe9c31f
...@@ -793,7 +793,6 @@ qemuExtTPMStartEmulator(virQEMUDriverPtr driver, ...@@ -793,7 +793,6 @@ qemuExtTPMStartEmulator(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
bool incomingMigration) bool incomingMigration)
{ {
int ret = -1;
g_autoptr(virCommand) cmd = NULL; g_autoptr(virCommand) cmd = NULL;
int exitstatus = 0; int exitstatus = 0;
g_autofree char *errbuf = NULL; g_autofree char *errbuf = NULL;
...@@ -817,23 +816,23 @@ qemuExtTPMStartEmulator(virQEMUDriverPtr driver, ...@@ -817,23 +816,23 @@ qemuExtTPMStartEmulator(virQEMUDriverPtr driver,
cfg->swtpm_group, cfg->swtpm_group,
cfg->swtpmStateDir, shortName, cfg->swtpmStateDir, shortName,
incomingMigration))) incomingMigration)))
goto cleanup; return -1;
if (qemuExtDeviceLogCommand(driver, vm, cmd, "TPM Emulator") < 0) if (qemuExtDeviceLogCommand(driver, vm, cmd, "TPM Emulator") < 0)
goto cleanup; return -1;
virCommandSetErrorBuffer(cmd, &errbuf); virCommandSetErrorBuffer(cmd, &errbuf);
if (qemuSecurityStartTPMEmulator(driver, vm, cmd, if (qemuSecurityStartTPMEmulator(driver, vm, cmd,
cfg->swtpm_user, cfg->swtpm_group, cfg->swtpm_user, cfg->swtpm_group,
&exitstatus, &cmdret) < 0) &exitstatus, &cmdret) < 0)
goto cleanup; return -1;
if (cmdret < 0 || exitstatus != 0) { if (cmdret < 0 || exitstatus != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not start 'swtpm'. exitstatus: %d, " _("Could not start 'swtpm'. exitstatus: %d, "
"error: %s"), exitstatus, errbuf); "error: %s"), exitstatus, errbuf);
goto cleanup; return -1;
} }
/* check that the swtpm has written its pid into the file */ /* check that the swtpm has written its pid into the file */
...@@ -852,15 +851,12 @@ qemuExtTPMStartEmulator(virQEMUDriverPtr driver, ...@@ -852,15 +851,12 @@ qemuExtTPMStartEmulator(virQEMUDriverPtr driver,
if (timeout <= 0) if (timeout <= 0)
goto error; goto error;
ret = 0; return 0;
cleanup:
return ret;
error: error:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("swtpm failed to start")); _("swtpm failed to start"));
goto cleanup; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册