aboutsummaryrefslogtreecommitdiff
path: root/libstb
diff options
context:
space:
mode:
authorClaudio Carvalho <cclaudio@linux.vnet.ibm.com>2016-11-28 01:08:13 -0200
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-11-29 18:17:02 +1100
commit8aba3cbf84225a5bc666a071c84758328ca87e76 (patch)
tree53fa726e297b254b6f563713c856f0c74c72f1eb /libstb
parent9d68320aa66c5ea274b736a7f4f757c907353bc4 (diff)
downloadskiboot-8aba3cbf84225a5bc666a071c84758328ca87e76.zip
skiboot-8aba3cbf84225a5bc666a071c84758328ca87e76.tar.gz
skiboot-8aba3cbf84225a5bc666a071c84758328ca87e76.tar.bz2
tpm_i2c_nuvoton: handle errors after reading the tpm fifo
This adds code to handle errors after reading the tpm fifo in tpm_read_fifo(). Fixes: 56ad053c3e8bf0764ad5878cb018f00a389d30cf Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libstb')
-rw-r--r--libstb/drivers/tpm_i2c_nuvoton.c12
1 files changed, 11 insertions, 1 deletions
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);