All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: cadence: Store the core controller in platform drvdata
@ 2026-09-15  3:00 Linmao Li
  2026-09-15  3:11 ` sashiko-bot
  2026-09-15  5:52 ` Aksh Garg
  0 siblings, 2 replies; 3+ messages in thread
From: Linmao Li @ 2026-09-15  3:00 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam
  Cc: Rob Herring, Aksh Garg, Tom Joseph, Vladimir Oltean, linux-pci,
	linux-kernel, Linmao Li

cdns_plat_pcie_probe() stores a struct cdns_plat_pcie pointer with
platform_set_drvdata(). cdns_plat_pcie_shutdown() and the callbacks in
cdns_pcie_pm_ops retrieve the same pointer with dev_get_drvdata() and
use it as a struct cdns_pcie pointer. This makes them read phy_count
and phy beyond the wrapper.

Store the wrapped struct cdns_pcie pointer instead.

Fixes: bd22885aa188 ("PCI: cadence: Refactor driver to use as a core library")
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
---
 drivers/pci/controller/cadence/pcie-cadence-plat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/cadence/pcie-cadence-plat.c b/drivers/pci/controller/cadence/pcie-cadence-plat.c
index 13edc6be21f5..7fef237cdbb7 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-plat.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-plat.c
@@ -55,7 +55,6 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev)
 	if (!cdns_plat_pcie)
 		return -ENOMEM;
 
-	platform_set_drvdata(pdev, cdns_plat_pcie);
 	if (is_rc) {
 		if (!IS_ENABLED(CONFIG_PCIE_CADENCE_PLAT_HOST))
 			return -ENODEV;
@@ -114,6 +113,8 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev)
 			goto err_init;
 	}
 
+	platform_set_drvdata(pdev, cdns_plat_pcie->pcie);
+
 	return 0;
 
  err_init:

base-commit: 9a9d18547ddc97a73d5d90cff4d5aef90bd8c15d
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-15  5:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-15  3:00 [PATCH] PCI: cadence: Store the core controller in platform drvdata Linmao Li
2026-09-15  3:11 ` sashiko-bot
2026-09-15  5:52 ` Aksh Garg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.