staging: iio: fix trigger handler of iio_simple_dummy driver
authorPeter Meerwald <pmeerw@pmeerw.net>
Fri, 22 Jun 2012 07:47:41 +0000 (09:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Jun 2012 04:24:27 +0000 (21:24 -0700)
accessing first and last channel fails:
fakedata[0] is never accessed, out-of-bound access for last channel

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/iio_simple_dummy_buffer.c

index fa4939caee6a075d2e37a5616021808106cb4b80..d91196021c0d52c7dc4f48ccefd7bf01d73deaf8 100644 (file)
@@ -75,9 +75,9 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p)
                for (i = 0, j = 0;
                     i < bitmap_weight(indio_dev->active_scan_mask,
                                       indio_dev->masklength);
-                    i++) {
+                    i++, j++) {
                        j = find_next_bit(buffer->scan_mask,
-                                         indio_dev->masklength, j + 1);
+                                         indio_dev->masklength, j);
                        /* random access read from the 'device' */
                        data[i] = fakedata[j];
                        len += 2;