char/tpm: Check return code of wait_for_tpm_stat
authorPeter Huewe <peterhuewe@gmx.de>
Tue, 11 Oct 2016 12:01:01 +0000 (15:01 +0300)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Sun, 27 Nov 2016 23:31:30 +0000 (01:31 +0200)
commit2c97f6f20cb193264360067259029892c70ce63f
treebe45d5b5a8d0ec44474c1a82813e6d32de1e3d9c
parente74f2f76c13770bb8e004475a933923e9c92723d
char/tpm: Check return code of wait_for_tpm_stat

In some weird cases it might be possible that the TPM does not set
STS.VALID within the given timeout time (or ever) but sets STS.EXPECT
(STS=0x0C) In this case the driver gets stuck in the while loop of
tpm_tis_send_data and loops endlessly.

Checking the return value of wait_for_tpm_stat fixes this and the driver
bails out correctly.  While at it fixing all other users since if the
TPM does not manage to set STS.VALID within the reasonable timeframe
something is definitely wrong and the driver should react correctly.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
drivers/char/tpm/tpm_tis_core.c