From 9c79ac0863f8c6e9ef923501dd11812ad565156f Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Sat, 7 Nov 2015 22:34:57 +0100 Subject: [PATCH] bcwc_pcie: reset ringbuffer index if current index is above size --- bcwc_ringbuf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bcwc_ringbuf.c b/bcwc_ringbuf.c index 39c8a4c..5e8896e 100644 --- a/bcwc_ringbuf.c +++ b/bcwc_ringbuf.c @@ -87,6 +87,8 @@ struct bcwc_ringbuf_entry *bcwc_channel_ringbuf_send(struct bcwc_private *dev_pr struct bcwc_ringbuf_entry *entry; entry = get_entry_addr(dev_priv, chan, chan->ringbuf.send_idx++); + if (chan->ringbuf.send_idx > chan->size) + chan->ringbuf.send_idx = 0; pr_debug("send entry %p offset %08x\n", entry, data_offset); entry->request_size = request_size; entry->response_size = response_size;