diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2014-04-20 19:55:41 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-05-23 12:50:40 -0400 |
commit | b646f0b7290c2cb68450c61256eb475e44437026 (patch) | |
tree | 4f1c4452fece5bd531b978dbe976484895f6e7a1 /drivers/media/v4l2-core | |
parent | a5c075cfd2386a4f3ab4f8ed2830ebee557d4b3f (diff) |
[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>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-core.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 40024d7daf00..8d37e291f722 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -2087,9 +2087,6 @@ static void __vb2_queue_cancel(struct vb2_queue *q) | |||
2087 | */ | 2087 | */ |
2088 | if (q->start_streaming_called) | 2088 | if (q->start_streaming_called) |
2089 | call_void_qop(q, stop_streaming, q); | 2089 | call_void_qop(q, stop_streaming, q); |
2090 | q->streaming = 0; | ||
2091 | q->start_streaming_called = 0; | ||
2092 | q->queued_count = 0; | ||
2093 | 2090 | ||
2094 | if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { | 2091 | if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { |
2095 | for (i = 0; i < q->num_buffers; ++i) | 2092 | for (i = 0; i < q->num_buffers; ++i) |
@@ -2099,6 +2096,10 @@ static void __vb2_queue_cancel(struct vb2_queue *q) | |||
2099 | WARN_ON(atomic_read(&q->owned_by_drv_count)); | 2096 | WARN_ON(atomic_read(&q->owned_by_drv_count)); |
2100 | } | 2097 | } |
2101 | 2098 | ||
2099 | q->streaming = 0; | ||
2100 | q->start_streaming_called = 0; | ||
2101 | q->queued_count = 0; | ||
2102 | |||
2102 | /* | 2103 | /* |
2103 | * Remove all buffers from videobuf's list... | 2104 | * Remove all buffers from videobuf's list... |
2104 | */ | 2105 | */ |