Skip to content

Commit

Permalink
tpm: Exit in reset when backend indicates failure
Browse files Browse the repository at this point in the history
Exit() in the frontend reset function when the backend indicates
intialization failure.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit bcfd16f)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
stefanberger authored and mdroth committed Jul 30, 2019
1 parent 0318166 commit 51ce84e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion hw/tpm/tpm_crb.c
Expand Up @@ -265,7 +265,9 @@ static void tpm_crb_reset(void *dev)
s->be_buffer_size = MIN(tpm_backend_get_buffer_size(s->tpmbe),
CRB_CTRL_CMD_SIZE);

tpm_backend_startup_tpm(s->tpmbe, s->be_buffer_size);
if (tpm_backend_startup_tpm(s->tpmbe, s->be_buffer_size) < 0) {
exit(1);
}
}

static void tpm_crb_realize(DeviceState *dev, Error **errp)
Expand Down
4 changes: 3 additions & 1 deletion hw/tpm/tpm_tis.c
Expand Up @@ -895,7 +895,9 @@ static void tpm_tis_reset(DeviceState *dev)
s->rw_offset = 0;
}

tpm_backend_startup_tpm(s->be_driver, s->be_buffer_size);
if (tpm_backend_startup_tpm(s->be_driver, s->be_buffer_size) < 0) {
exit(1);
}
}

/* persistent state handling */
Expand Down

0 comments on commit 51ce84e

Please sign in to comment.