aboutsummaryrefslogtreecommitdiff
path: root/hw/tpm/tpm_emulator.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-01-29 19:33:06 +0100
committerStefan Berger <stefanb@linux.vnet.ibm.com>2018-01-29 14:22:43 -0500
commit6a8a23549a6ddb4af47b032db76badf131c5c2e6 (patch)
tree77ff1a758180aa07eb4239d7db6cf704278aa03f /hw/tpm/tpm_emulator.c
parentc4fb8561bcec5f3ae3ae2d8a688d1e1aeb247a91 (diff)
tpm: report backend request error
Use an Error** for request to let the caller handle error reporting. This will also allow to inform the frontend of a backend error. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Diffstat (limited to 'hw/tpm/tpm_emulator.c')
-rw-r--r--hw/tpm/tpm_emulator.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/hw/tpm/tpm_emulator.c b/hw/tpm/tpm_emulator.c
index 81bf7d1b01..710a9ec718 100644
--- a/hw/tpm/tpm_emulator.c
+++ b/hw/tpm/tpm_emulator.c
@@ -183,28 +183,19 @@ static int tpm_emulator_set_locality(TPMEmulator *tpm_emu, uint8_t locty_number,
return 0;
}
-static void tpm_emulator_handle_request(TPMBackend *tb, TPMBackendCmd *cmd)
+static void tpm_emulator_handle_request(TPMBackend *tb, TPMBackendCmd *cmd,
+ Error **errp)
{
TPMEmulator *tpm_emu = TPM_EMULATOR(tb);
- Error *err = NULL;
DPRINTF("processing TPM command");
- if (tpm_emulator_set_locality(tpm_emu, cmd->locty, &err) < 0) {
- goto error;
- }
-
- if (tpm_emulator_unix_tx_bufs(tpm_emu, cmd->in, cmd->in_len,
+ if (tpm_emulator_set_locality(tpm_emu, cmd->locty, errp) < 0 ||
+ tpm_emulator_unix_tx_bufs(tpm_emu, cmd->in, cmd->in_len,
cmd->out, cmd->out_len,
- &cmd->selftest_done, &err) < 0) {
- goto error;
+ &cmd->selftest_done, errp) < 0) {
+ tpm_util_write_fatal_error_response(cmd->out, cmd->out_len);
}
-
- return;
-
-error:
- tpm_util_write_fatal_error_response(cmd->out, cmd->out_len);
- error_report_err(err);
}
static int tpm_emulator_probe_caps(TPMEmulator *tpm_emu)