summaryrefslogtreecommitdiff
path: root/drivers/staging/media/zoran/zoran_driver.c
diff options
context:
space:
mode:
authorCorentin Labbe <clabbe@baylibre.com>2021-12-14 17:16:26 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-01-23 21:18:39 +0100
commit82e3a496eb56da0b9f29fdc5b63cedb3289e91de (patch)
tree81a93ffc8ea583d89389240d819c5fffc0180c62 /drivers/staging/media/zoran/zoran_driver.c
parent49ebe7c38d04bf965b7d0c673788794896a2ebfd (diff)
media: staging: media: zoran: move videodev alloc
Move some code out of zr36057_init() and create new functions for handling zr->video_dev. This permit to ease code reading and fix a zr->video_dev memory leak. Signed-off-by: Corentin Labbe <clabbe@baylibre.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/staging/media/zoran/zoran_driver.c')
-rw-r--r--drivers/staging/media/zoran/zoran_driver.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c
index 46382e43f1bf..551db338c7f7 100644
--- a/drivers/staging/media/zoran/zoran_driver.c
+++ b/drivers/staging/media/zoran/zoran_driver.c
@@ -1008,7 +1008,7 @@ static const struct vb2_ops zr_video_qops = {
.wait_finish = vb2_ops_wait_finish,
};
-int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq)
+int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq, int dir)
{
int err;
@@ -1016,7 +1016,8 @@ int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq)
INIT_LIST_HEAD(&zr->queued_bufs);
vq->dev = &zr->pci_dev->dev;
- vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ vq->type = dir;
+
vq->io_modes = VB2_USERPTR | VB2_DMABUF | VB2_MMAP | VB2_READ | VB2_WRITE;
vq->drv_priv = zr;
vq->buf_struct_size = sizeof(struct zr_buffer);