Commit 4845187b authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

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: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a8947fcf
...@@ -293,7 +293,7 @@ again: ...@@ -293,7 +293,7 @@ again:
return -EAGAIN; return -EAGAIN;
memcpy(data, last_written_p_copy, ring->buf.bpd); 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; goto again;
iio_unmark_sw_rb_in_use(&ring->buf); iio_unmark_sw_rb_in_use(&ring->buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment