[media] v4l2: vb2: one more fix for REQBUFS()
authorMarek Szyprowski <m.szyprowski@samsung.com>
Fri, 11 Mar 2011 09:07:27 +0000 (06:07 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 22 Mar 2011 07:54:28 +0000 (04:54 -0300)
Return immediately if the target number of buffers is the same as
the current one and memory access type doesn't change.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/videobuf2-core.c

index c5f99c7d397965f279427150035ffd931784593a..2baf7dbdc01db5b8703ecf1d8540d63a41809501 100644 (file)
@@ -488,6 +488,13 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
                return -EINVAL;
        }
 
+       /*
+        * If the same number of buffers and memory access method is requested
+        * then return immediately.
+        */
+       if (q->memory == req->memory && req->count == q->num_buffers)
+               return 0;
+
        if (req->count == 0 || q->num_buffers != 0 || q->memory != req->memory) {
                /*
                 * We already have buffers allocated, so first check if they