From 6ef52cd7519d0166382bb7743de6fd34c6c6436d Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Mon, 27 Mar 2017 17:04:26 -0500 Subject: 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 Reviewed-on: https://review.coreboot.org/19058 Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- src/drivers/spi/tpm/tis.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/drivers/spi/tpm/tis.c') 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; } -- cgit v1.2.3