Skip to content

Commit 9298075

Browse files
naynajainJarkko Sakkinen
authored andcommitted
tpm: move the delay_msec increment after sleep in tpm_transmit()
Commit e2fb992 ("tpm: add retry logic") introduced a new loop to handle the TPM2_RC_RETRY error. The loop retries the command after sleeping for the specified time, which is incremented exponentially in every iteration. Unfortunately, the loop doubles the time before sleeping, causing the initial sleep to be doubled. This patch fixes the initial sleep time. Fixes: commit e2fb992 ("tpm: add retry logic") Signed-off-by: Nayna Jain <[email protected]> Reviewed-by: Mimi Zohar <[email protected]> Tested-by: Jarkko Sakkinen <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent 5859cdf commit 9298075

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/char/tpm/tpm-interface.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
587587
*/
588588
if (rc == TPM2_RC_TESTING && cc == TPM2_CC_SELF_TEST)
589589
break;
590-
delay_msec *= 2;
590+
591591
if (delay_msec > TPM2_DURATION_LONG) {
592592
if (rc == TPM2_RC_RETRY)
593593
dev_err(&chip->dev, "in retry loop\n");
@@ -597,6 +597,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
597597
break;
598598
}
599599
tpm_msleep(delay_msec);
600+
delay_msec *= 2;
600601
memcpy(buf, save, save_size);
601602
}
602603
return ret;

0 commit comments

Comments
 (0)