summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorChristophe RICARD <christophe.ricard@gmail.com>2016-02-13 16:15:30 +0100
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2016-06-25 17:26:35 +0300
commit4ef2aa3c1bfe237cb349a52ed6f68e4cbfc5ccb9 (patch)
tree43f1c46f226cf28aecaeb6f71c88580972a329a5 /drivers/char
parent300796cdb5ba624031a5e1e5992e670eb457c231 (diff)
downloadlinux-4ef2aa3c1bfe237cb349a52ed6f68e4cbfc5ccb9.tar.bz2
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.c5
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)
&data, 1);
latency++;
}
+ if (status < 0)
+ return status;
+ if (latency == MAX_SPI_LATENCY)
+ return -ENODEV;
+
return latency - 1;
} /* evaluate_latency() */