|
@@ -410,6 +410,8 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
|
|
|
&chip->vendor.read_queue)
|
|
|
== 0) {
|
|
|
burstcnt = get_burstcount(chip);
|
|
|
+ if (burstcnt < 0)
|
|
|
+ return burstcnt;
|
|
|
len = min_t(int, burstcnt, count - size);
|
|
|
I2C_READ_DATA(client, TPM_DATA_FIFO, buf + size, len);
|
|
|
size += len;
|
|
@@ -451,7 +453,8 @@ static irqreturn_t tpm_ioserirq_handler(int irq, void *dev_id)
|
|
|
static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
|
|
|
size_t len)
|
|
|
{
|
|
|
- u32 status, burstcnt = 0, i, size;
|
|
|
+ u32 status, i, size;
|
|
|
+ int burstcnt = 0;
|
|
|
int ret;
|
|
|
u8 data;
|
|
|
struct i2c_client *client;
|
|
@@ -482,6 +485,8 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
|
|
|
|
|
|
for (i = 0; i < len - 1;) {
|
|
|
burstcnt = get_burstcount(chip);
|
|
|
+ if (burstcnt < 0)
|
|
|
+ return burstcnt;
|
|
|
size = min_t(int, len - i - 1, burstcnt);
|
|
|
ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size);
|
|
|
if (ret < 0)
|