diff mbox

[07/12] tpm/st33zp24/spi: Improve st33zp24_spi_evaluate_latency

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

Commit Message

Christophe Ricard Feb. 9, 2016, 9:26 a.m. UTC
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>
---
 drivers/char/tpm/st33zp24/spi.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jarkko Sakkinen Feb. 11, 2016, 2:22 p.m. UTC | #1
On Tue, Feb 09, 2016 at 10:26:56AM +0100, Christophe Ricard wrote:
> 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>

/Jarkko

> ---
>  drivers/char/tpm/st33zp24/spi.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c
> index 0af836a..7cabf1d 100644
> --- a/drivers/char/tpm/st33zp24/spi.c
> +++ b/drivers/char/tpm/st33zp24/spi.c
> @@ -213,6 +213,11 @@ static int st33zp24_spi_evaluate_latency(void *phy_id)
>  						&data, 1);
>  		latency++;
>  	}
> +	if (status < 0)
> +		return status;
> +	if (latency == MAX_SPI_LATENCY)
> +		return -ENODEV;
> +
>  	return latency - 1;
>  } /* evaluate_latency() */
>  
> -- 
> 2.5.0
> 

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
diff mbox

Patch

diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c
index 0af836a..7cabf1d 100644
--- a/drivers/char/tpm/st33zp24/spi.c
+++ b/drivers/char/tpm/st33zp24/spi.c
@@ -213,6 +213,11 @@  static int st33zp24_spi_evaluate_latency(void *phy_id)
 						&data, 1);
 		latency++;
 	}
+	if (status < 0)
+		return status;
+	if (latency == MAX_SPI_LATENCY)
+		return -ENODEV;
+
 	return latency - 1;
 } /* evaluate_latency() */