From: Jonathan Cameron <jic23@cam.ac.uk>
To: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH] Fix staging:iio:ring_sw: Fix incorrect test on successful read of last value, causes infinite loop
Date: Tue, 30 Mar 2010 17:45:04 +0100 [thread overview]
Message-ID: <4BB22A90.6070801@cam.ac.uk> (raw)
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
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;
iio_unmark_sw_rb_in_use(&ring->buf);
--
1.6.4.4
reply other threads:[~2010-03-30 16:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BB22A90.6070801@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=gregkh@suse.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox