Re: [PATCH] PCI: j721e: Properly check the error of a syscon lookup
From: Garg, Aksh
Date: Fri Nov 27 2026 - 05:36:57 EST
On 27/11/26 15:49, Anton Protopopov wrote:
> 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. Propagate the error instead.
>
> Fixes: 82c4be4168e2 ("PCI: j721e: Enable ACSPCIE Refclk if "ti,syscon-acspcie-proxy-ctrl" exists")
> Signed-off-by: Anton Protopopov <a.s.protopopov@xxxxxxxxx>
> ---
Reviewed-by: Aksh Garg <a-garg7@xxxxxx>
Regards,
Aksh Garg
>
> (Accidentally bumped into this while working on BPF stuff.)
>
> 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);
> }