]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
staging: iio: ring_sw: Fix incorrect test on successful read of last value, causes...
authorJonathan Cameron <jic23@cam.ac.uk>
Tue, 30 Mar 2010 16:45:04 +0000 (17:45 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 30 Apr 2010 16:30:09 +0000 (09:30 -0700)
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>
drivers/staging/iio/ring_sw.c

index b104c3d9c35ef44b79e1a08bbed3eb30a2b71d12..cf22c091668cfaaf402853a81334d26032f22929 100644 (file)
@@ -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);