Skip to content

Commit

Permalink
staging: iio: ring_sw: Fix incorrect test on successful read of last …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Apr 30, 2010
1 parent a8947fc commit 4845187
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/iio/ring_sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ int iio_read_last_from_sw_ring(struct iio_sw_ring_buffer *ring,
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);
Expand Down

0 comments on commit 4845187

Please sign in to comment.