Merge tag 'md/3.16' of git://neil.brown.name/md
[deliverable/linux.git] / drivers / media / v4l2-core / videobuf2-core.c
index 40024d7daf009fcc1b19218d4f816fd6faf027ce..349e659d75fb861359165665638fad93a2293631 100644 (file)
@@ -905,7 +905,7 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
         * Make sure the requested values and current defaults are sane.
         */
        num_buffers = min_t(unsigned int, req->count, VIDEO_MAX_FRAME);
-       num_buffers = max_t(unsigned int, req->count, q->min_buffers_needed);
+       num_buffers = max_t(unsigned int, num_buffers, q->min_buffers_needed);
        memset(q->plane_sizes, 0, sizeof(q->plane_sizes));
        memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx));
        q->memory = req->memory;
@@ -2087,9 +2087,6 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
         */
        if (q->start_streaming_called)
                call_void_qop(q, stop_streaming, q);
-       q->streaming = 0;
-       q->start_streaming_called = 0;
-       q->queued_count = 0;
 
        if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
                for (i = 0; i < q->num_buffers; ++i)
@@ -2099,6 +2096,10 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
                WARN_ON(atomic_read(&q->owned_by_drv_count));
        }
 
+       q->streaming = 0;
+       q->start_streaming_called = 0;
+       q->queued_count = 0;
+
        /*
         * Remove all buffers from videobuf's list...
         */
@@ -2150,10 +2151,6 @@ static int vb2_internal_streamon(struct vb2_queue *q, enum v4l2_buf_type type)
                return -EINVAL;
        }
 
-       if (!q->num_buffers) {
-               dprintk(1, "no buffers have been allocated\n");
-               return -EINVAL;
-       }
        if (q->num_buffers < q->min_buffers_needed) {
                dprintk(1, "need at least %u allocated buffers\n",
                                q->min_buffers_needed);
This page took 0.028637 seconds and 5 git commands to generate.