Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: "Manivannan Sadhasivam" <mani@kernel.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Cc: Rob Herring <robh@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	linux-pci@vger.kernel.org,  llvm@lists.linux.dev,
	linux-kernel@vger.kernel.org,  Ian Rogers <irogers@google.com>,
	Aksh Garg <a-garg7@ti.com>,
	 Cyrille Pitchen <cyrille.pitchen@free-electrons.com>
Subject: [PATCH 1/2] PCI: cadence: Set .owner = THIS_MODULE in cdns_pcie_epc_ops
Date: Thu,  3 Dec 2026 09:16:40 -0800	[thread overview]
Message-ID: <20261203171642.440891-2-irogers@google.com> (raw)
In-Reply-To: <20261203171642.440891-1-irogers@google.com>

pci_epc_get() calls try_module_get(epc->ops->owner) and pci_epc_put()
calls module_put(epc->ops->owner), while __pci_epc_create() ignores its
owner parameter because epc->ops is const struct pci_epc_ops *. Because
pcie-cadence-ep can be built as a module (CONFIG_PCIE_CADENCE_EP),
omitting .owner leaves the module unpinned while an endpoint controller
reference is held.

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

Fixes: 37dddf14f1ae ("PCI: cadence: Add EndPoint Controller driver for Cadence PCIe controller")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/pci/controller/cadence/pcie-cadence-ep.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c
index a967f7762283..eda5e2da90db 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-ep.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c
@@ -648,6 +648,7 @@ static const struct pci_epc_ops cdns_pcie_epc_ops = {
 	.map_msi_irq	= cdns_pcie_ep_map_msi_irq,
 	.start		= cdns_pcie_ep_start,
 	.get_features	= cdns_pcie_ep_get_features,
+	.owner		= THIS_MODULE,
 };
 
 void cdns_pcie_ep_disable(struct cdns_pcie_ep *ep)
-- 
2.56.1.839.g22a8290db9-goog


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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 17:16 [PATCH 0/2] PCI: endpoint: Set .owner = THIS_MODULE in struct pci_epc_ops Ian Rogers
2026-12-03 17:16 ` Ian Rogers [this message]
2026-12-03 18:33   ` [PATCH 1/2] PCI: cadence: Set .owner = THIS_MODULE in cdns_pcie_epc_ops sashiko-bot
2026-12-03 17:16 ` [PATCH 2/2] PCI: endpoint: Set .owner = THIS_MODULE in remaining pci_epc_ops Ian Rogers
2026-12-03 18:47 ` [PATCH 0/2] PCI: endpoint: Set .owner = THIS_MODULE in struct pci_epc_ops sashiko-bot

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=20261203171642.440891-2-irogers@google.com \
    --to=irogers@google.com \
    --cc=a-garg7@ti.com \
    --cc=bhelgaas@google.com \
    --cc=cyrille.pitchen@free-electrons.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=nathan@kernel.org \
    --cc=robh@kernel.org \
    /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