Correct issue that the last entry in FIFO was being read twice due
to an incorrect decrement of entry count variable before condition
check.
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
        mutex_lock(&data->lock);
        data->gesture_mode_running = 1;
 
-       while (cnt-- || (cnt = apds9660_fifo_is_empty(data) > 0)) {
+       while (cnt || (cnt = apds9660_fifo_is_empty(data) > 0)) {
                ret = regmap_bulk_read(data->regmap, APDS9960_REG_GFIFO_BASE,
                                      &data->buffer, 4);
 
                        goto err_read;
 
                iio_push_to_buffers(data->indio_dev, data->buffer);
+               cnt--;
        }
 
 err_read: