]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: ti-vpe: cal: Fix a WARN issued when start streaming fails
authorBenoit Parrot <bparrot@ti.com>
Tue, 12 Nov 2019 14:53:45 +0000 (15:53 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 9 Dec 2019 10:40:01 +0000 (11:40 +0100)
When start_streaming fails after the buffers have been queued we have to
make sure all buffers are returned to user-space properly otherwise a
v4l2 level WARN is generated.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/ti-vpe/cal.c

index 091119bee8fc669a24a1efadc67962fc2b9df5d2..92a54d59d43386613a6a1ee4c951bb7e3e18201e 100644 (file)
@@ -1695,10 +1695,15 @@ static int cal_start_streaming(struct vb2_queue *vq, unsigned int count)
        return 0;
 
 err:
+       spin_lock_irqsave(&ctx->slock, flags);
+       vb2_buffer_done(&ctx->cur_frm->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
+       ctx->cur_frm = NULL;
+       ctx->next_frm = NULL;
        list_for_each_entry_safe(buf, tmp, &dma_q->active, list) {
                list_del(&buf->list);
                vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
        }
+       spin_unlock_irqrestore(&ctx->slock, flags);
        return ret;
 }