upstream: [media] vb2: call buf_finish after the state check
authorHans Verkuil <hans.verkuil@cisco.com>
Fri, 28 Feb 2014 16:30:48 +0000 (13:30 -0300)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:54:55 +0000 (11:54 +0900)
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>
drivers/media/v4l2-core/videobuf2-core.c

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