From b74fccad751d2664bda9dd3c90646bb61295e774 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Fri, 25 Mar 2016 20:42:58 -0700 Subject: iio: health: max30100: correct FIFO check condition 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 Signed-off-by: Jonathan Cameron --- drivers/iio/health/max30100.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/iio/health/max30100.c') diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c index 09db89359544..90ab8a2d2846 100644 --- a/drivers/iio/health/max30100.c +++ b/drivers/iio/health/max30100.c @@ -238,12 +238,13 @@ static irqreturn_t max30100_interrupt_handler(int irq, void *private) mutex_lock(&data->lock); - while (cnt-- || (cnt = max30100_fifo_count(data) > 0)) { + while (cnt || (cnt = max30100_fifo_count(data) > 0)) { ret = max30100_read_measurement(data); if (ret) break; iio_push_to_buffers(data->indio_dev, data->buffer); + cnt--; } mutex_unlock(&data->lock); -- cgit v1.2.3-58-ga151