diff mbox series

[for,v4.20,1/5] vb2: don't call __vb2_queue_cancel if vb2_start_streaming failed

Message ID 20181128083747.18530-2-hverkuil-cisco@xs4all.nl (mailing list archive)
State New, archived
Headers show
Series vb2 fixes (mostly request API related) | expand

Commit Message

Hans Verkuil Nov. 28, 2018, 8:37 a.m. UTC
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>

vb2_start_streaming() already rolls back the buffers, so there is no
need to call __vb2_queue_cancel(). Especially since __vb2_queue_cancel()
does too much, such as zeroing the q->queued_count value, causing vb2
to think that no buffers have been queued.

It appears that this call to __vb2_queue_cancel() is a left-over from
before commit b3379c6201bb3.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: b3379c6201bb3 ('vb2: only call start_streaming if sufficient buffers are queued')
Cc: <stable@vger.kernel.org>      # for v4.16 and up
---
 drivers/media/common/videobuf2/videobuf2-core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Sakari Ailus Nov. 28, 2018, 12:14 p.m. UTC | #1
On Wed, Nov 28, 2018 at 09:37:43AM +0100, hverkuil-cisco@xs4all.nl wrote:
> From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> 
> vb2_start_streaming() already rolls back the buffers, so there is no
> need to call __vb2_queue_cancel(). Especially since __vb2_queue_cancel()
> does too much, such as zeroing the q->queued_count value, causing vb2
> to think that no buffers have been queued.
> 
> It appears that this call to __vb2_queue_cancel() is a left-over from
> before commit b3379c6201bb3.
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Fixes: b3379c6201bb3 ('vb2: only call start_streaming if sufficient buffers are queued')
> Cc: <stable@vger.kernel.org>      # for v4.16 and up

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

> ---
>  drivers/media/common/videobuf2/videobuf2-core.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
> index 0ca81d495bda..77e2bfe5e722 100644
> --- a/drivers/media/common/videobuf2/videobuf2-core.c
> +++ b/drivers/media/common/videobuf2/videobuf2-core.c
> @@ -1941,10 +1941,8 @@ int vb2_core_streamon(struct vb2_queue *q, unsigned int type)
>  		if (ret)
>  			return ret;
>  		ret = vb2_start_streaming(q);
> -		if (ret) {
> -			__vb2_queue_cancel(q);
> +		if (ret)
>  			return ret;
> -		}
>  	}
>  
>  	q->streaming = 1;
diff mbox series

Patch

diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
index 0ca81d495bda..77e2bfe5e722 100644
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
@@ -1941,10 +1941,8 @@  int vb2_core_streamon(struct vb2_queue *q, unsigned int type)
 		if (ret)
 			return ret;
 		ret = vb2_start_streaming(q);
-		if (ret) {
-			__vb2_queue_cancel(q);
+		if (ret)
 			return ret;
-		}
 	}
 
 	q->streaming = 1;