* [PATCH v2 1/2] PCI: j721e: Check the error of the ACSPCIE syscon lookup
@ 2026-12-01 11:34 Anton Protopopov
2026-12-01 11:32 ` sashiko-bot
2026-12-01 11:34 ` [PATCH v2 2/2] PCI: j721e: Put the syscon nodes after parsing their arguments Anton Protopopov
0 siblings, 2 replies; 3+ messages in thread
From: Anton Protopopov @ 2026-12-01 11:34 UTC (permalink / raw)
To: Vignesh Raghavendra, Siddharth Vadapalli, Manivannan Sadhasivam,
Krzysztof Wilczyński, Lorenzo Pieralisi, Bjorn Helgaas,
Rob Herring, Aksh Garg, linux-pci, linux-omap, linux-arm-kernel,
linux-kernel
Cc: Anton Protopopov
The syscon_regmap_lookup_by_phandle_optional() function returns NULL
only when the property is missing (-ENODEV). On other errors it
returns an error pointer. The j721e_pcie_ctrl_init() function checks
only for NULL and passes an error pointer to j721e_enable_acspcie_refclk(),
which uses it as a regmap. This leads to an oops.
The lookup may fail with a correct device tree too: it returns
-EPROBE_DEFER when the hwspinlock of the syscon or the driver which
registers its regmap is not probed yet. Propagate the error, so that
the probe is retried.
Fixes: 82c4be4168e2 ("PCI: j721e: Enable ACSPCIE Refclk if "ti,syscon-acspcie-proxy-ctrl" exists")
Reviewed-by: Aksh Garg <a-garg7@ti.com>
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
---
v1 -> v2:
- Drop "Properly" from the subject
- Say that the error pointer leads to an oops and that the lookup
may return -EPROBE_DEFER
v1: https://lore.kernel.org/linux-pci/20261127101915.1348807-1-a.s.protopopov@gmail.com/
drivers/pci/controller/cadence/pci-j721e.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
index 822602836b12..fdae51e368e0 100644
--- a/drivers/pci/controller/cadence/pci-j721e.c
+++ b/drivers/pci/controller/cadence/pci-j721e.c
@@ -334,6 +334,8 @@ static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie)
"ti,syscon-acspcie-proxy-ctrl");
if (!syscon)
return 0;
+ if (IS_ERR(syscon))
+ return PTR_ERR(syscon);
return j721e_enable_acspcie_refclk(pcie, syscon);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 1/2] PCI: j721e: Check the error of the ACSPCIE syscon lookup 2026-12-01 11:34 [PATCH v2 1/2] PCI: j721e: Check the error of the ACSPCIE syscon lookup Anton Protopopov @ 2026-12-01 11:32 ` sashiko-bot 2026-12-01 11:34 ` [PATCH v2 2/2] PCI: j721e: Put the syscon nodes after parsing their arguments Anton Protopopov 1 sibling, 0 replies; 3+ messages in thread From: sashiko-bot @ 2026-12-01 11:32 UTC (permalink / raw) To: Anton Protopopov, linux-pci Sashiko has reviewed this 2-patch series and found no issues. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261201113427.342670-1-a.s.protopopov@gmail.com ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] PCI: j721e: Put the syscon nodes after parsing their arguments 2026-12-01 11:34 [PATCH v2 1/2] PCI: j721e: Check the error of the ACSPCIE syscon lookup Anton Protopopov 2026-12-01 11:32 ` sashiko-bot @ 2026-12-01 11:34 ` Anton Protopopov 1 sibling, 0 replies; 3+ messages in thread From: Anton Protopopov @ 2026-12-01 11:34 UTC (permalink / raw) To: Vignesh Raghavendra, Siddharth Vadapalli, Manivannan Sadhasivam, Krzysztof Wilczyński, Lorenzo Pieralisi, Bjorn Helgaas, Rob Herring, Aksh Garg, linux-pci, linux-omap, linux-arm-kernel, linux-kernel Cc: Anton Protopopov The of_parse_phandle_with_fixed_args() function returns the node in args.np with a reference. The j721e_pcie_ctrl_init() and j721e_enable_acspcie_refclk() functions use only the argument and never put the node. The j721e_pcie_ctrl_init() function runs on each attempt to probe and on each resume, so every system resume leaks one or two node references. Put the nodes after reading the arguments. Fixes: 7aa256234c4c ("PCI: j721e: Get offset within "syscon" from "ti,syscon-pcie-ctrl" phandle arg") Fixes: 82c4be4168e2 ("PCI: j721e: Enable ACSPCIE Refclk if "ti,syscon-acspcie-proxy-ctrl" exists") Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com> --- drivers/pci/controller/cadence/pci-j721e.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c index fdae51e368e0..a82e208cb6bc 100644 --- a/drivers/pci/controller/cadence/pci-j721e.c +++ b/drivers/pci/controller/cadence/pci-j721e.c @@ -256,6 +256,7 @@ static int j721e_enable_acspcie_refclk(struct j721e_pcie *pcie, /* Clear PAD IO disable bits to enable refclk output */ val = ~(args.args[0]); + of_node_put(args.np); ret = regmap_update_bits(syscon, 0, mask, val); if (ret) { dev_err(dev, "failed to enable ACSPCIE refclk: %d\n", ret); @@ -283,8 +284,10 @@ static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie) /* Do not error out to maintain old DT compatibility */ ret = of_parse_phandle_with_fixed_args(node, "ti,syscon-pcie-ctrl", 1, 0, &args); - if (!ret) + if (!ret) { offset = args.args[0]; + of_node_put(args.np); + } /* * The PCIe Controller's registers have different "reset-values" ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-01 11:32 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-01 11:34 [PATCH v2 1/2] PCI: j721e: Check the error of the ACSPCIE syscon lookup Anton Protopopov 2026-12-01 11:32 ` sashiko-bot 2026-12-01 11:34 ` [PATCH v2 2/2] PCI: j721e: Put the syscon nodes after parsing their arguments Anton Protopopov
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.