summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2010-03-30 17:45:04 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-04-30 09:30:09 -0700
commit4845187b39b79e3c1d4474c2767ddc7fb493eb05 (patch)
tree78743d925597e96220b6a1d63fdd3f72bac1f766
parenta8947fcf3bbeda9fc6ff1205e51f8ff1b0128cc4 (diff)
downloadlinux-4845187b39b79e3c1d4474c2767ddc7fb493eb05.tar.gz
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.c2
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);