tpm_tis_spi: Abort transfer when too many wait states are signaled

Abort the transfer with ETIMEDOUT when the TPM signals more than
TPM_RETRY wait states. Continuing with the transfer in this state
will only lead to arbitrary failures in other parts of the code.

Cc: <stable@vger.kernel.org>
Fixes: 0edbfea537 ("tpm/tpm_tis_spi: Add support for spi phy")
Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
Signed-off-by: Peter Huewe <peter.huewe@infineon.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Benoit Houyere <benoit.houyere@st.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
This commit is contained in:
Peter Huewe 2017-03-02 13:03:12 +00:00 коммит произвёл Jarkko Sakkinen
Родитель f848f2143a
Коммит 975094ddc3
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -101,6 +101,11 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
goto exit;
}
if (i == TPM_RETRY) {
ret = -ETIMEDOUT;
goto exit;
}
spi_xfer.cs_change = 0;
spi_xfer.len = len;