[media] vb2: call buf_finish after the state check

Don't call buf_finish unless we know that the buffer is in a valid state.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
Hans Verkuil 2014-02-28 13:30:48 -03:00 committed by Mauro Carvalho Chehab
parent 3f1a9a33a5
commit 9cf3c31a8b
1 changed files with 2 additions and 2 deletions

View File

@ -1929,8 +1929,6 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool n
if (ret < 0) if (ret < 0)
return ret; return ret;
call_vb_qop(vb, buf_finish, vb);
switch (vb->state) { switch (vb->state) {
case VB2_BUF_STATE_DONE: case VB2_BUF_STATE_DONE:
dprintk(3, "dqbuf: Returning done buffer\n"); dprintk(3, "dqbuf: Returning done buffer\n");
@ -1943,6 +1941,8 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool n
return -EINVAL; return -EINVAL;
} }
call_vb_qop(vb, buf_finish, vb);
/* Fill buffer information for the userspace */ /* Fill buffer information for the userspace */
__fill_v4l2_buffer(vb, b); __fill_v4l2_buffer(vb, b);
/* Remove from videobuf queue */ /* Remove from videobuf queue */