summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2015-01-13 23:13:14 +0100
committerPeter Huewe <peterhuewe@gmx.de>2015-01-17 15:03:50 +0100
commitc4eadfafb91d5501095c55ffadaa1168743f39d3 (patch)
tree42c41981e13588f42c8b02a553a3a4c1bfa6d20f
parentaec04cbdf7231c1b0da76172de82dfa2388a80d7 (diff)
downloadop-kernel-dev-c4eadfafb91d5501095c55ffadaa1168743f39d3.zip
op-kernel-dev-c4eadfafb91d5501095c55ffadaa1168743f39d3.tar.gz
tpm/tpm_i2c_stm_st33: Add status check when reading data on the FIFO
Add a return value check when reading data from the FIFO register. Cc: <stable@vger.kernel.org> Reviewed-by: Jason Gunthorpe <jason.gunthorpe@obsidianresearch.com> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Reviewed-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
-rw-r--r--drivers/char/tpm/tpm_i2c_stm_st33.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index 48c4808..4f70296 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -441,7 +441,7 @@ again:
*/
static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
{
- int size = 0, burstcnt, len;
+ int size = 0, burstcnt, len, ret;
struct tpm_stm_dev *tpm_dev;
tpm_dev = (struct tpm_stm_dev *)TPM_VPRIV(chip);
@@ -455,7 +455,10 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
if (burstcnt < 0)
return burstcnt;
len = min_t(int, burstcnt, count - size);
- I2C_READ_DATA(tpm_dev, TPM_DATA_FIFO, buf + size, len);
+ ret = I2C_READ_DATA(tpm_dev, TPM_DATA_FIFO, buf + size, len);
+ if (ret < 0)
+ return ret;
+
size += len;
}
return size;
OpenPOWER on IntegriCloud