mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PCI: j721e: Properly check the error of a syscon lookup
@ 2026-11-27 10:19 Anton Protopopov
  2026-11-27 10:36 ` Garg, Aksh
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Protopopov @ 2026-11-27 10:19 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. 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@gmail.com>
---

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

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

* Re: [PATCH] PCI: j721e: Properly check the error of a syscon lookup
  2026-11-27 10:19 [PATCH] PCI: j721e: Properly check the error of a syscon lookup Anton Protopopov
@ 2026-11-27 10:36 ` Garg, Aksh
  0 siblings, 0 replies; 2+ messages in thread
From: Garg, Aksh @ 2026-11-27 10:36 UTC (permalink / raw)
  To: Anton Protopopov, Raghavendra, Vignesh, Vadapalli, Siddharth,
	Manivannan Sadhasivam, Krzysztof Wilczyński,
	Lorenzo Pieralisi, Bjorn Helgaas, Rob Herring, linux-pci,
	linux-omap, linux-arm-kernel, linux-kernel

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@gmail.com>
> ---

Reviewed-by: Aksh Garg <a-garg7@ti.com>

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


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

end of thread, other threads:[~2026-11-27 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27 10:19 [PATCH] PCI: j721e: Properly check the error of a syscon lookup Anton Protopopov
2026-11-27 10:36 ` Garg, Aksh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®