[PATCH v2 1/2] PCI: j721e: Check the error of the ACSPCIE syscon lookup

From: Anton Protopopov

Date: Tue Dec 01 2026 - 06:22:45 EST


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@xxxxxx>
Signed-off-by: Anton Protopopov <a.s.protopopov@xxxxxxxxx>
---
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@xxxxxxxxx/

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);
}