[Skiboot] [PATCH 13/14] tpm_i2c_nuvoton: handle errors after reading the tpm fifo
Claudio Carvalho
cclaudio at linux.vnet.ibm.com
Mon Nov 28 14:08:13 AEDT 2016
This adds code to handle errors after reading the tpm fifo in
tpm_read_fifo().
Fixes: 56ad053c3e8bf0764ad5878cb018f00a389d30cf
Signed-off-by: Claudio Carvalho <cclaudio at linux.vnet.ibm.com>
---
libstb/drivers/tpm_i2c_nuvoton.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/libstb/drivers/tpm_i2c_nuvoton.c b/libstb/drivers/tpm_i2c_nuvoton.c
index a4cc371..f39ca9c 100644
--- a/libstb/drivers/tpm_i2c_nuvoton.c
+++ b/libstb/drivers/tpm_i2c_nuvoton.c
@@ -389,8 +389,18 @@ static int tpm_read_fifo(uint8_t* buf, size_t* buflen)
count += burst_count;
DBG("%s FIFO: %d bytes read, count=%zd, rc=%d\n",
(rc) ? "!!!!" : "----", burst_count, count, rc);
- if (rc < 0)
+ if (rc < 0) {
+ /**
+ * @fwts-label TPMReadFifo
+ * @fwts-advice Either the tpm device or the tpm-i2c interface
+ * doesn't seem to be working properly. Check the return code
+ * (rc) for further details.
+ */
+ prlog(PR_ERR, "NUVOTON: fail to read fifo, count=%zd, "
+ "rc=%d\n", count, rc);
+ rc = STB_DRIVER_ERROR;
goto error;
+ }
rc = tpm_wait_for_fifo_status(
TPM_STS_VALID | TPM_STS_DATA_AVAIL,
TPM_STS_VALID | TPM_STS_DATA_AVAIL);
--
1.9.1
More information about the Skiboot
mailing list