iio: chemical: sps30: fix a loop timeout test

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

Fixes: 232e0f6dde ("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>
This commit is contained in:
Dan Carpenter 2019-02-09 12:03:52 +03:00 committed by Jonathan Cameron
parent d4cd36220e
commit 905889b4a3
1 changed files with 1 additions and 1 deletions

View File

@ -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);