Commit c2529908 authored by Florian Echtler's avatar Florian Echtler Committed by Mauro Carvalho Chehab

[media] sur40: fix occasional hard freeze due to buffer queue underrun

This patch fixes a kernel panic which occurs when buf_list is empty. This can
happen occasionally when user space is under heavy load (e.g. due to image
processing on the CPU) and new buffers aren't re-queued fast enough. In that
case, vb2_start_streaming_called can return true, but when the spinlock
is taken and sur40_poll attempts to fetch the next buffer from buf_list, the
list is in fact empty.

This patch needs to be applied on top of the queued one adding V4L2 support
to the sur40 driver.
Signed-off-by: default avatarFlorian Echtler <floe@butterbrot.org>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent af7f388e
......@@ -380,6 +380,11 @@ static void sur40_process_video(struct sur40_state *sur40)
/* get a new buffer from the list */
spin_lock(&sur40->qlock);
if (list_empty(&sur40->buf_list)) {
dev_dbg(sur40->dev, "buffer queue empty\n");
spin_unlock(&sur40->qlock);
return;
}
new_buf = list_entry(sur40->buf_list.next, struct sur40_buffer, list);
list_del(&new_buf->list);
spin_unlock(&sur40->qlock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment