diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2010-03-30 18:45:04 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-04-30 18:30:09 +0200 |
commit | 4845187b39b79e3c1d4474c2767ddc7fb493eb05 (patch) | |
tree | 78743d925597e96220b6a1d63fdd3f72bac1f766 | |
parent | staging: iio: Function iio_get_new_idr_val() return negative value if fails. (diff) | |
download | linux-4845187b39b79e3c1d4474c2767ddc7fb493eb05.tar.xz linux-4845187b39b79e3c1d4474c2767ddc7fb493eb05.zip |
staging: iio: ring_sw: Fix incorrect test on successful read of last value, causes infinite loop
This is a bad one. The test means that almost no reads of the last
value ever succeed! Result is an infinite loop.
Another one for the 'oops' category.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/iio/ring_sw.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/iio/ring_sw.c b/drivers/staging/iio/ring_sw.c index b104c3d9c35e..cf22c091668c 100644 --- a/drivers/staging/iio/ring_sw.c +++ b/drivers/staging/iio/ring_sw.c @@ -293,7 +293,7 @@ again: return -EAGAIN; memcpy(data, last_written_p_copy, ring->buf.bpd); - if (unlikely(ring->last_written_p >= last_written_p_copy)) + if (unlikely(ring->last_written_p != last_written_p_copy)) goto again; iio_unmark_sw_rb_in_use(&ring->buf); |