* [PATCH 0/5] media: Set missing .owner = THIS_MODULE in V4L2 and D-PHY ops
@ 2026-12-03 17:15 Ian Rogers
2026-12-03 17:15 ` [PATCH 1/5] media: amlogic: c3-isp: Set .owner = THIS_MODULE in v4l2_file_operations Ian Rogers
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Ian Rogers @ 2026-12-03 17:15 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil, Sakari Ailus,
Laurent Pinchart
Cc: Nathan Chancellor, linux-media, llvm, linux-kernel, Ian Rogers
Five modular media drivers omit .owner = THIS_MODULE in their const
struct v4l2_file_operations or struct phy_ops definitions, leaving the
module owner NULL for chrdev_open() or phy_get() reference counting.
Split per driver to simplify review and stable backporting.
Tooling note: Found using Clang's require_explicit_initialization
attribute; an AI coding assistant helped audit call sites, verify Fixes
commits, and draft the changelogs. All affected files were build-tested
as modules (-DMODULE) with LLVM=1.
Ian Rogers (5):
media: amlogic: c3-isp: Set .owner = THIS_MODULE in
v4l2_file_operations
media: rockchip: rkcif: Set .owner = THIS_MODULE in
v4l2_file_operations
media: rkisp1: Set .owner = THIS_MODULE in v4l2_file_operations
staging: media: ipu3: Set .owner = THIS_MODULE in v4l2_file_operations
media: sunxi: a83t-mipi-csi2: Set .owner = THIS_MODULE in phy_ops
drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c | 1 +
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c | 1 +
drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c | 1 +
drivers/media/platform/rockchip/rkcif/rkcif-stream.c | 1 +
drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c | 1 +
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c | 3 ++-
drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c | 3 ++-
.../platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_dphy.c | 1 +
drivers/staging/media/ipu3/ipu3-v4l2.c | 1 +
9 files changed, 11 insertions(+), 2 deletions(-)
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] media: amlogic: c3-isp: Set .owner = THIS_MODULE in v4l2_file_operations
2026-12-03 17:15 [PATCH 0/5] media: Set missing .owner = THIS_MODULE in V4L2 and D-PHY ops Ian Rogers
@ 2026-12-03 17:15 ` Ian Rogers
2026-12-03 17:15 ` [PATCH 2/5] media: rockchip: rkcif: " Ian Rogers
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Ian Rogers @ 2026-12-03 17:15 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil, Sakari Ailus,
Laurent Pinchart
Cc: Nathan Chancellor, linux-media, llvm, linux-kernel, Ian Rogers,
Keke Li, Jacopo Mondi
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 isp_cap_v4l2_fops, isp_params_v4l2_fops, and
isp_stats_v4l2_fops, found with Clang's require_explicit_initialization
attribute.
Fixes: fb2e135208f3 ("media: platform: Add C3 ISP driver")
Signed-off-by: Ian Rogers <irogers@google.com>
---
drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c | 1 +
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c | 1 +
drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c b/drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c
index 11d85f5342f0..da0506548d34 100644
--- a/drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c
+++ b/drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c
@@ -502,6 +502,7 @@ static const struct v4l2_file_operations isp_cap_v4l2_fops = {
.poll = vb2_fop_poll,
.unlocked_ioctl = video_ioctl2,
.mmap = vb2_fop_mmap,
+ .owner = THIS_MODULE,
};
static int c3_isp_cap_link_validate(struct media_link *link)
diff --git a/drivers/media/platform/amlogic/c3/isp/c3-isp-params.c b/drivers/media/platform/amlogic/c3/isp/c3-isp-params.c
index ae0777a20bda..686f22c99d69 100644
--- a/drivers/media/platform/amlogic/c3/isp/c3-isp-params.c
+++ b/drivers/media/platform/amlogic/c3/isp/c3-isp-params.c
@@ -764,6 +764,7 @@ static const struct v4l2_file_operations isp_params_v4l2_fops = {
.poll = vb2_fop_poll,
.unlocked_ioctl = video_ioctl2,
.mmap = vb2_fop_mmap,
+ .owner = THIS_MODULE,
};
static int c3_isp_params_vb2_queue_setup(struct vb2_queue *q,
diff --git a/drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c b/drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c
index 8a5d7e1a30c9..888a4a6434e8 100644
--- a/drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c
+++ b/drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c
@@ -140,6 +140,7 @@ static const struct v4l2_file_operations isp_stats_v4l2_fops = {
.poll = vb2_fop_poll,
.unlocked_ioctl = video_ioctl2,
.mmap = vb2_fop_mmap,
+ .owner = THIS_MODULE,
};
static int c3_isp_stats_vb2_queue_setup(struct vb2_queue *q,
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] media: rockchip: rkcif: Set .owner = THIS_MODULE in v4l2_file_operations
2026-12-03 17:15 [PATCH 0/5] media: Set missing .owner = THIS_MODULE in V4L2 and D-PHY ops Ian Rogers
2026-12-03 17:15 ` [PATCH 1/5] media: amlogic: c3-isp: Set .owner = THIS_MODULE in v4l2_file_operations Ian Rogers
@ 2026-12-03 17:15 ` Ian Rogers
2026-12-03 17:15 ` [PATCH 3/5] media: rkisp1: " Ian Rogers
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Ian Rogers @ 2026-12-03 17:15 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil, Sakari Ailus,
Laurent Pinchart
Cc: Nathan Chancellor, linux-media, llvm, linux-kernel, Ian Rogers,
Mehdi Djait, Michael Riesch, Heiko Stuebner, Hans Verkuil,
Gerald Loacker, Bryan O'Donoghue, linux-arm-kernel,
linux-rockchip
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@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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] media: rkisp1: Set .owner = THIS_MODULE in v4l2_file_operations
2026-12-03 17:15 [PATCH 0/5] media: Set missing .owner = THIS_MODULE in V4L2 and D-PHY ops Ian Rogers
2026-12-03 17:15 ` [PATCH 1/5] media: amlogic: c3-isp: Set .owner = THIS_MODULE in v4l2_file_operations Ian Rogers
2026-12-03 17:15 ` [PATCH 2/5] media: rockchip: rkcif: " Ian Rogers
@ 2026-12-03 17:15 ` Ian Rogers
2026-12-03 17:15 ` [PATCH 4/5] staging: media: ipu3: " Ian Rogers
2026-12-03 17:15 ` [PATCH 5/5] media: sunxi: a83t-mipi-csi2: Set .owner = THIS_MODULE in phy_ops Ian Rogers
4 siblings, 0 replies; 6+ messages in thread
From: Ian Rogers @ 2026-12-03 17:15 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil, Sakari Ailus,
Laurent Pinchart
Cc: Nathan Chancellor, linux-media, llvm, linux-kernel, Ian Rogers,
Dafna Hirschfeld, Heiko Stuebner, Jacob Chen, Eddie Cai,
Allon Huang, Tomasz Figa, Yichong Zhong, linux-rockchip,
linux-arm-kernel
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 rkisp1_fops, rkisp1_params_fops, and
rkisp1_stats_fops, found with Clang's require_explicit_initialization
attribute.
Fixes: 56e3b29f9f6b ("media: staging: rkisp1: add streaming paths")
Fixes: bae1155cf579 ("media: staging: rkisp1: add output device for parameters")
Fixes: 9a28dbd65a88 ("media: staging: rkisp1: add capture device for statistics")
Signed-off-by: Ian Rogers <irogers@google.com>
---
drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c | 1 +
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c | 3 ++-
drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c | 3 ++-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
index 20d88865081c..29a1f99046f0 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
@@ -1503,6 +1503,7 @@ static const struct v4l2_file_operations rkisp1_fops = {
.unlocked_ioctl = video_ioctl2,
.poll = vb2_fop_poll,
.mmap = vb2_fop_mmap,
+ .owner = THIS_MODULE,
};
static void rkisp1_unregister_capture(struct rkisp1_capture *cap)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
index 042b759eba62..034470afadfd 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
@@ -2806,7 +2806,8 @@ static const struct v4l2_file_operations rkisp1_params_fops = {
.unlocked_ioctl = video_ioctl2,
.poll = vb2_fop_poll,
.open = v4l2_fh_open,
- .release = vb2_fop_release
+ .release = vb2_fop_release,
+ .owner = THIS_MODULE,
};
static int rkisp1_params_init_vb2_queue(struct vb2_queue *q,
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
index d5fdb8f82dc7..02dc144152e5 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
@@ -85,7 +85,8 @@ static const struct v4l2_file_operations rkisp1_stats_fops = {
.unlocked_ioctl = video_ioctl2,
.poll = vb2_fop_poll,
.open = v4l2_fh_open,
- .release = vb2_fop_release
+ .release = vb2_fop_release,
+ .owner = THIS_MODULE,
};
static int rkisp1_stats_vb2_queue_setup(struct vb2_queue *vq,
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] staging: media: ipu3: Set .owner = THIS_MODULE in v4l2_file_operations
2026-12-03 17:15 [PATCH 0/5] media: Set missing .owner = THIS_MODULE in V4L2 and D-PHY ops Ian Rogers
` (2 preceding siblings ...)
2026-12-03 17:15 ` [PATCH 3/5] media: rkisp1: " Ian Rogers
@ 2026-12-03 17:15 ` Ian Rogers
2026-12-03 17:15 ` [PATCH 5/5] media: sunxi: a83t-mipi-csi2: Set .owner = THIS_MODULE in phy_ops Ian Rogers
4 siblings, 0 replies; 6+ messages in thread
From: Ian Rogers @ 2026-12-03 17:15 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil, Sakari Ailus,
Laurent Pinchart
Cc: Nathan Chancellor, linux-media, llvm, linux-kernel, Ian Rogers,
Greg Kroah-Hartman, Yong Zhi, linux-staging
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 imgu_v4l2_fops, found with Clang's
require_explicit_initialization attribute.
Fixes: a0ca1627b450 ("media: staging/intel-ipu3: Add v4l2 driver based on media framework")
Signed-off-by: Ian Rogers <irogers@google.com>
---
drivers/staging/media/ipu3/ipu3-v4l2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
index 61fdefe78c3d..12b808c2bf7e 100644
--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
+++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
@@ -951,6 +951,7 @@ static const struct v4l2_file_operations imgu_v4l2_fops = {
.release = vb2_fop_release,
.poll = vb2_fop_poll,
.mmap = vb2_fop_mmap,
+ .owner = THIS_MODULE,
};
/******************** v4l2_ioctl_ops ********************/
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] media: sunxi: a83t-mipi-csi2: Set .owner = THIS_MODULE in phy_ops
2026-12-03 17:15 [PATCH 0/5] media: Set missing .owner = THIS_MODULE in V4L2 and D-PHY ops Ian Rogers
` (3 preceding siblings ...)
2026-12-03 17:15 ` [PATCH 4/5] staging: media: ipu3: " Ian Rogers
@ 2026-12-03 17:15 ` Ian Rogers
4 siblings, 0 replies; 6+ messages in thread
From: Ian Rogers @ 2026-12-03 17:15 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil, Sakari Ailus,
Laurent Pinchart
Cc: Nathan Chancellor, linux-media, llvm, linux-kernel, Ian Rogers,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Paul Kocialkowski,
Maxime Ripard, linux-arm-kernel, linux-sunxi
phy_get() and of_phy_get() call try_module_get(phy->ops->owner) to pin
the PHY provider module while the PHY is in use, and of_phy_put() calls
module_put(phy->ops->owner). sun8i-a83t-mipi-csi2 can be built as a
module (CONFIG_VIDEO_SUN8I_A83T_MIPI_CSI2), so omitting .owner leaves
phy->ops->owner NULL.
Set .owner = THIS_MODULE in sun8i_a83t_dphy_ops, found with Clang's
require_explicit_initialization attribute.
Fixes: 576d196c522b ("media: sunxi: Add support for the A83T MIPI CSI-2 controller")
Signed-off-by: Ian Rogers <irogers@google.com>
---
.../media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_dphy.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_dphy.c b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_dphy.c
index 24bbcc85013d..b14982df5f25 100644
--- a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_dphy.c
+++ b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_dphy.c
@@ -47,6 +47,7 @@ static const struct phy_ops sun8i_a83t_dphy_ops = {
.configure = sun8i_a83t_dphy_configure,
.power_on = sun8i_a83t_dphy_power_on,
.power_off = sun8i_a83t_dphy_power_off,
+ .owner = THIS_MODULE,
};
int sun8i_a83t_dphy_register(struct sun8i_a83t_mipi_csi2_device *csi2_dev)
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-03 17:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 17:15 [PATCH 0/5] media: Set missing .owner = THIS_MODULE in V4L2 and D-PHY ops Ian Rogers
2026-12-03 17:15 ` [PATCH 1/5] media: amlogic: c3-isp: Set .owner = THIS_MODULE in v4l2_file_operations Ian Rogers
2026-12-03 17:15 ` [PATCH 2/5] media: rockchip: rkcif: " Ian Rogers
2026-12-03 17:15 ` [PATCH 3/5] media: rkisp1: " Ian Rogers
2026-12-03 17:15 ` [PATCH 4/5] staging: media: ipu3: " Ian Rogers
2026-12-03 17:15 ` [PATCH 5/5] media: sunxi: a83t-mipi-csi2: Set .owner = THIS_MODULE in phy_ops Ian Rogers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox