summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattis fjallstrom <mattis@acm.org>2016-02-05 13:13:04 -0800
committermattis fjallstrom <mattis@acm.org>2016-02-12 18:19:24 -0800
commit300fe054140b75c5a7bc3c53077b3c4c200e82b9 (patch)
tree416ddfe410969ea2ff597e3c620801d74a30c942
parentd1294a7ffe9438c3449b4e74c381c081cc6f786e (diff)
downloadolio-linux-3.10-300fe054140b75c5a7bc3c53077b3c4c200e82b9.tar.xz
olio-linux-3.10-300fe054140b75c5a7bc3c53077b3c4c200e82b9.zip
Making sure that the status never returns 0 in case of error (theoretical possibility earlier).
Change-Id: I068df2530a032b3c2734e777c31dd72aa0a285f3
-rw-r--r--drivers/staging/triune/ts81001.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/staging/triune/ts81001.c b/drivers/staging/triune/ts81001.c
index ed6f8abc78f..85a56fe5b66 100644
--- a/drivers/staging/triune/ts81001.c
+++ b/drivers/staging/triune/ts81001.c
@@ -134,7 +134,10 @@ static int ts81001_write_i2c_blk(struct i2c_client * client, u8 reg_addr,
*
* This function reads the status from the device on the i2c bus. The
* ts81001 can be really slow to react, so we'll try again a few times
- * before accepting failure.
+ * before accepting failure.
+ *
+ * If we can't read a value, we return -1. This let's other parts of the
+ * system know that we failed to read status, and not change anything.
*/
static int ts81001_get_status (struct ts81001 * ts) {
@@ -153,7 +156,7 @@ static int ts81001_get_status (struct ts81001 * ts) {
if (err <= 0) {
olio_debug ("Error reading status from ts81001, err = %d\n",
err);
- state = err;
+ state = -1;
} else {
state = (ts81001_state_t) data;
break;