Commit 905889b4 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jonathan Cameron

iio: chemical: sps30: fix a loop timeout test

The "while (tries--) {" loop is a postop so it exits with "tries" set
to -1.

Fixes: 232e0f6d ("iio: chemical: add support for Sensirion SPS30 sensor")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent d4cd3622
...@@ -210,7 +210,7 @@ static int sps30_do_meas(struct sps30_state *state, s32 *data, int size) ...@@ -210,7 +210,7 @@ static int sps30_do_meas(struct sps30_state *state, s32 *data, int size)
msleep_interruptible(300); msleep_interruptible(300);
} }
if (!tries) if (tries == -1)
return -ETIMEDOUT; return -ETIMEDOUT;
ret = sps30_do_cmd(state, SPS30_READ_DATA, tmp, sizeof(int) * size); ret = sps30_do_cmd(state, SPS30_READ_DATA, tmp, sizeof(int) * size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment