From: Jonathan Cameron Date: Tue, 30 Mar 2010 16:45:04 +0000 (+0100) Subject: staging: iio: ring_sw: Fix incorrect test on successful read of last value, causes... X-Git-Tag: upstream/snapshot3+hdmi~14722^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4845187b39b79e3c1d4474c2767ddc7fb493eb05;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/ring_sw.c b/drivers/staging/iio/ring_sw.c index b104c3d..cf22c09 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);