[Skiboot] [PATCH 11/14] tpm_i2c_nuvoton: handle errors after writting the tpm fifo

Claudio Carvalho cclaudio at linux.vnet.ibm.com
Mon Nov 28 14:08:11 AEDT 2016


This adds code to handle errors after writting the tpm fifo in
tpm_write_fifo().

Fixes: 56ad053c3e8bf0764ad5878cb018f00a389d30cf
Signed-off-by: Claudio Carvalho <cclaudio at linux.vnet.ibm.com>
---
 libstb/drivers/tpm_i2c_nuvoton.c | 13 +++++++++++--
 1 file 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);
-- 
1.9.1



More information about the Skiboot mailing list