diff options
author | Christophe RICARD <christophe.ricard@gmail.com> | 2016-02-13 10:15:30 -0500 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-06-25 10:21:42 -0400 |
commit | 10460bc1cfdea19dbab2289a63b4be0c874d29f2 (patch) | |
tree | d44fbb0fecbebe96104d84425f46321ac131f0ff /drivers/char | |
parent | b55c8e9f14710d4f91579b2cb9a03734ec38bdab (diff) |
tpm/st33zp24/spi: Improve st33zp24_spi_evaluate_latency
Add check in st33zp24_spi_evaluate_latency helping to diagnose if the chip
is present or in a bad state.
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/tpm/st33zp24/spi.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c index 08e6bf54d7dd..a2ef8ec4ba80 100644 --- a/drivers/char/tpm/st33zp24/spi.c +++ b/drivers/char/tpm/st33zp24/spi.c | |||
@@ -214,6 +214,11 @@ static int st33zp24_spi_evaluate_latency(void *phy_id) | |||
214 | &data, 1); | 214 | &data, 1); |
215 | latency++; | 215 | latency++; |
216 | } | 216 | } |
217 | if (status < 0) | ||
218 | return status; | ||
219 | if (latency == MAX_SPI_LATENCY) | ||
220 | return -ENODEV; | ||
221 | |||
217 | return latency - 1; | 222 | return latency - 1; |
218 | } /* evaluate_latency() */ | 223 | } /* evaluate_latency() */ |
219 | 224 | ||