aboutsummaryrefslogtreecommitdiff
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:33:13 +1100
commitb1275bcfdbf7936b8f2a8ab11e8929b1a04aae52 (patch)
treef990d3f367b28120b7f5f10fdcd5cbdc896a7882
parent4c688b870bd62f0cdc92ea2d7ed167f6f9fd24c4 (diff)
downloadskiboot-b1275bcfdbf7936b8f2a8ab11e8929b1a04aae52.zip
skiboot-b1275bcfdbf7936b8f2a8ab11e8929b1a04aae52.tar.gz
skiboot-b1275bcfdbf7936b8f2a8ab11e8929b1a04aae52.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> (cherry picked from commit 8aba3cbf84225a5bc666a071c84758328ca87e76) Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-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);