diff options
author | Aaron Durbin <adurbin@chromium.org> | 2017-03-27 17:04:26 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2017-04-03 05:32:21 +0200 |
commit | 6ef52cd7519d0166382bb7743de6fd34c6c6436d (patch) | |
tree | a4542f08a71ad2ab9eef9cb090e4c05d30c8b964 /src/drivers/spi/tpm | |
parent | 445c13fb5daf483005ec87670f9937499032c98d (diff) |
drivers/spi/tpm: honor tis_sendrecv() API
The spi tis_sendrecv() implementation was always returning success
for all transactions. Correct this by returning -1 on error when
tpm2_process_command() returns 0 since that's its current failure
return code.
BUG=b:36598499
Change-Id: I8bfb5a09198ae4c293330e770271773a185d5061
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/19058
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/drivers/spi/tpm')
-rw-r--r-- | src/drivers/spi/tpm/tis.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/drivers/spi/tpm/tis.c b/src/drivers/spi/tpm/tis.c index d3c727cb27..481c9da1d0 100644 --- a/src/drivers/spi/tpm/tis.c +++ b/src/drivers/spi/tpm/tis.c @@ -85,6 +85,11 @@ int tis_sendrecv(const uint8_t *sendbuf, size_t sbuf_size, uint8_t *recvbuf, size_t *rbuf_len) { int len = tpm2_process_command(sendbuf, sbuf_size, recvbuf, *rbuf_len); + + if (len == 0) + return -1; + *rbuf_len = len; + return 0; } |