aboutsummaryrefslogtreecommitdiff
path: root/libstb
diff options
context:
space:
mode:
authorClaudio Carvalho <cclaudio@linux.vnet.ibm.com>2016-11-28 01:08:11 -0200
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-11-29 18:17:02 +1100
commit0eb2fc7aa4fdd86876bf1663def0f91b1328b0be (patch)
tree1b7b17bfc30d5ed53468ca250108ad69dc45604c /libstb
parent58b0b4e2dd2fbdfcb9c4fc892008dcc7f1e2d153 (diff)
downloadskiboot-0eb2fc7aa4fdd86876bf1663def0f91b1328b0be.zip
skiboot-0eb2fc7aa4fdd86876bf1663def0f91b1328b0be.tar.gz
skiboot-0eb2fc7aa4fdd86876bf1663def0f91b1328b0be.tar.bz2
tpm_i2c_nuvoton: handle errors after writting the tpm fifo
This adds code to handle errors after writting the tpm fifo in tpm_write_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.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libstb/drivers/tpm_i2c_nuvoton.c b/libstb/drivers/tpm_i2c_nuvoton.c
index 28df2c7..e453b7c 100644
--- a/libstb/drivers/tpm_i2c_nuvoton.c
+++ b/libstb/drivers/tpm_i2c_nuvoton.c
@@ -279,8 +279,17 @@ static int tpm_write_fifo(uint8_t* buf, size_t buflen)
count += bytes;
DBG("%s FIFO: %zd bytes written, count=%zd, rc=%d\n",
(rc) ? "!!!!" : "----", bytes, count, rc);
- if (rc < 0)
- return rc;
+ if (rc < 0) {
+ /**
+ * @fwts-label TPMWriteFifo
+ * @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 write fifo, "
+ "count=%zd, rc=%d\n", count, rc);
+ return STB_DRIVER_ERROR;
+ }
rc = tpm_wait_for_fifo_status(TPM_STS_VALID | TPM_STS_EXPECT,
TPM_STS_VALID | TPM_STS_EXPECT);