upstream: [media] v4l: vb2: Avoid double WARN_ON when stopping streaming
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 20 Apr 2014 23:55:41 +0000 (20:55 -0300)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:59:21 +0000 (11:59 +0900)
commit0f8d19273906ee5ff9fa3672744a387e86984178
tree90007d3ffd45ccf2bb1a62ff255b231a73bee2f7
parent7f0ecf078dd7acda950894159b72b9ce53ba5d3e
upstream: [media] v4l: vb2: Avoid double WARN_ON when stopping streaming

The __vb2_queue_cancel function marks the queue as not streaming and
then WARNs when buffers are still owned by the driver. It proceeds to
complete all active buffers by calling vb2_buffer_done with the new
buffer state set to VB2_BUF_STATE_ERROR in that case. This triggers
another WARN_ON due to as new state not being VB2_BUF_STATE_QUEUED while
the queue is not streaming.

Check buffer ownership and complete all active buffers before marking
the queue as not streaming to avoid the double WARN_on.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/v4l2-core/videobuf2-core.c