From: Jonathan Cameron on

Signed-off-by: Jonathan Cameron <jic23(a)>

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.

Patch is post the spin lock fix:
[PATCH] Staging: IIO: Fix uses of spinlocks prior to init in ring implementations

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 7dff2bf..5abba8c 100644
--- a/drivers/staging/iio/ring_sw.c
+++ b/drivers/staging/iio/ring_sw.c
@@ -296,7 +296,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;


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at