diff mbox

[v3,2/3] tpm/tpm_tis: Return wait_for_tpm_stat return value instead

Message ID 1427146198-6145-3-git-send-email-christophe-h.ricard@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christophe Ricard March 23, 2015, 9:29 p.m. UTC
When check_cancel = true wait_for_tpm_stat can return -ECANCELED, which is
ignored here.

check_cancel = false here but will -ETIME in case of error.

Reported-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
---
 drivers/char/tpm/tpm_tis.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 6725bef..30bc409 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -392,12 +392,11 @@  static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len)
 		else
 			dur = tpm_calc_ordinal_duration(chip, ordinal);
 
-		if (wait_for_tpm_stat
-		    (chip, TPM_STS_DATA_AVAIL | TPM_STS_VALID, dur,
-		     &chip->vendor.read_queue, false) < 0) {
-			rc = -ETIME;
+		rc = wait_for_tpm_stat(chip,
+				TPM_STS_DATA_AVAIL | TPM_STS_VALID, dur,
+				&chip->vendor.read_queue, false);
+		if (rc < 0)
 			goto out_err;
-		}
 	}
 	return len;
 out_err: