[PATCH 2/5] media: rockchip: rkcif: Set .owner = THIS_MODULE in v4l2_file_operations

Ian Rogers irogers at google.com
Thu Dec 3 09:15:44 PST 2026


video_register_device() passes vdev->fops->owner to
__video_register_device(), which sets vdev->cdev->owner = owner so
chrdev_open() pins the V4L2 driver module while the device node is open.
When .owner is omitted in a const struct v4l2_file_operations,
vdev->cdev->owner is NULL and the driver module is not reference counted
on open().

Set .owner = THIS_MODULE in rkcif_stream_file_ops, found with Clang's
require_explicit_initialization attribute.

Fixes: 501802e2ad51 ("media: rockchip: rkcif: add abstraction for dma blocks")
Signed-off-by: Ian Rogers <irogers at google.com>
---
 drivers/media/platform/rockchip/rkcif/rkcif-stream.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
index 3130d420ad55..329c38d284f1 100644
--- a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
+++ b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
@@ -506,6 +506,7 @@ static const struct v4l2_file_operations rkcif_stream_file_ops = {
 	.unlocked_ioctl = video_ioctl2,
 	.poll = vb2_fop_poll,
 	.mmap = vb2_fop_mmap,
+	.owner = THIS_MODULE,
 };
 
 static int rkcif_stream_init_vb2_queue(struct vb2_queue *q,
-- 
2.56.1.839.g22a8290db9-goog




More information about the linux-arm-kernel mailing list