From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=213.167.242.64 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796349453; b=zIiKIvTrqlCEC5Qsd1D1eghabc3qdWV13M4vt1/Y0w/jvinPV4jj+Rex0TJIFiyXCfal VPq6HvWoqG/7FiB+XBwAX0yVmmFFRIxkpSYgcgtue1eZbMfvH3j7BlQkOcmfR9N2iRsmm qsvK4iXc1J59j/VCHILaNuJUXk6I7/8vSdkHUObt5vyqngnh7u8oAGU8LjCsRAJrJhQBE p7PzfJO75Cvmx5lEDOeOn/C5knPHJLS7l79dJRssVvH+aCklZVQMP3koaagELQKWVoZiz SH8bxcnaKkMDu1bNvOMdUVP+pVeL9Ssj+dZVNHLQYG20PfUT2gdCF+qxhlyqZZCQLWg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796349453; h=DMARC-Filter:Received:DKIM-Signature:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=PUgXtkNsIEZu/0R/2jJj+ZLz83JMj9p4HIlJOo1jBp4=; b=ygS2nQEUyrPbD9zN2xabbAiKlsztx/cD2o9QLRVnb5TqeLEhbxbgB2MXhw8Obc32VhRu RY06X0oXXOSqx7B+XtR6xElLp4WhzhrOROQGmvVg9n3BZ9QiNRwsgUETZhS2czy+5VSVs CZ8wzzGvyI403wI0OJXVphN8DKNvaapi+GJJr8T1A3my/RWgTH7FHiRg2ZyUm8iO4O/EE GFUI3nHPHMeRFKN13kBF5y24kqFwIWcJIgAzmn11sLEre4ztgWalKSQsbCT1PXFYvMrlp xfNg72VCd3O80prS3ASltasYztnIe7IA27/Ftnqj2WInwRhEPHtMhVRMZgo3mzXFenw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass header.d=ideasonboard.com header.i=@ideasonboard.com header.a=rsa-sha256 header.s=mail header.b=aRdpiZn3; arc=none smtp.remote-ip=213.167.242.64 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E40F5606A32C; Fri, 4 Dec 2026 01:57:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E40F5606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.a=rsa-sha256 header.s=mail header.b=aRdpiZn3 Received: from killaraus.ideasonboard.com (fp7965754b.ap.nuro.jp [121.101.117.75]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0BAC9227; Fri, 4 Dec 2026 02:54:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1796349288; bh=JAejbCbRwM/GZCAJxr+xm/NB2l72Qr1KrEOwBbimnYU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aRdpiZn3ET/tawHJW82Lf7CRErpBeREeCH/ZNXUhhRSI3XkuQNk00kfp/Lhpng3ab +QWePWcQoryo14a5183NpWuaWT3SuZDQTyKCnW2qAUPGAFpaCDvb3/81w/uJYZC92q O+ijUok7XCUvONOz41UJ4CUwl7+54y29Y0+VseHc= Date: Fri, 4 Dec 2026 10:57:23 +0900 From: Laurent Pinchart To: Ian Rogers Cc: Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Nathan Chancellor , linux-media@vger.kernel.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Keke Li , Jacopo Mondi Subject: Re: [PATCH 1/5] media: amlogic: c3-isp: Set .owner = THIS_MODULE in v4l2_file_operations Message-ID: <20261204015723.GA613470@killaraus.ideasonboard.com> References: <20261203171549.438355-1-irogers@google.com> <20261203171549.438355-2-irogers@google.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20261203171549.438355-2-irogers@google.com> On Thu, Dec 03, 2026 at 09:15:43AM -0800, Ian Rogers wrote: > 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. This sounds like a game of whack-a-mole. A better solution would be to improve the API to make this error impossible in the first place. I'll send an RFC. > Fixes: fb2e135208f3 ("media: platform: Add C3 ISP driver") > Signed-off-by: Ian Rogers > --- > 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, -- Regards, Laurent Pinchart