Skip to content

Commit

Permalink
tpm_i2c_nuvoton: handle errors after reading the tpm fifo
Browse files Browse the repository at this point in the history
This adds code to handle errors after reading the tpm fifo in
tpm_read_fifo().

Fixes: 56ad053
Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
Claudio Carvalho authored and stewartsmith committed Nov 29, 2016
1 parent 9d68320 commit 8aba3cb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion libstb/drivers/tpm_i2c_nuvoton.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8aba3cb

Please sign in to comment.