Skip to content

Commit

Permalink
tpm_i2c_nuvoton: handle errors after writting the tpm fifo
Browse files Browse the repository at this point in the history
This adds code to handle errors after writting the tpm fifo in
tpm_write_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 58b0b4e commit 0eb2fc7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions libstb/drivers/tpm_i2c_nuvoton.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0eb2fc7

Please sign in to comment.