Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@kernel.org>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Nathan Chancellor <nathan@kernel.org>,
	linux-media@vger.kernel.org, llvm@lists.linux.dev,
	 linux-kernel@vger.kernel.org, Ian Rogers <irogers@google.com>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Yong Zhi <yong.zhi@intel.com>,
	 linux-staging@lists.linux.dev
Subject: [PATCH 4/5] staging: media: ipu3: Set .owner = THIS_MODULE in v4l2_file_operations
Date: Thu,  3 Dec 2026 09:15:46 -0800	[thread overview]
Message-ID: <20261203171549.438355-5-irogers@google.com> (raw)
In-Reply-To: <20261203171549.438355-1-irogers@google.com>

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


  parent reply	other threads:[~2026-12-03 17:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Ian Rogers [this message]
2026-12-03 17:15 ` [PATCH 5/5] media: sunxi: a83t-mipi-csi2: Set .owner = THIS_MODULE in phy_ops Ian Rogers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203171549.438355-5-irogers@google.com \
    --to=irogers@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=llvm@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=nathan@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=yong.zhi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox