summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-02-09 10:03:52 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-02-09 19:46:02 +0100
commit905889b4a34c753a538015f0b2cdaa0c9e3a4fd5 (patch)
tree0cbe7d3b00f9d51da7520a6280eb065ba5d3c55f /drivers/iio
parentiio:accel:adxl345: Change alignment to match paranthesis (diff)
downloadlinux-905889b4a34c753a538015f0b2cdaa0c9e3a4fd5.tar.xz
linux-905889b4a34c753a538015f0b2cdaa0c9e3a4fd5.zip
iio: chemical: sps30: fix a loop timeout test
The "while (tries--) {" loop is a postop so it exits with "tries" set to -1. Fixes: 232e0f6ddeae ("iio: chemical: add support for Sensirion SPS30 sensor") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/chemical/sps30.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c
index e03a28a67146..375df5060ed5 100644
--- a/drivers/iio/chemical/sps30.c
+++ b/drivers/iio/chemical/sps30.c
@@ -210,7 +210,7 @@ static int sps30_do_meas(struct sps30_state *state, s32 *data, int size)
msleep_interruptible(300);
}
- if (!tries)
+ if (tries == -1)
return -ETIMEDOUT;
ret = sps30_do_cmd(state, SPS30_READ_DATA, tmp, sizeof(int) * size);