All of lore.kernel.org
 help / color / mirror / Atom feed
* 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:15 ` sashiko-bot
  2026-11-27 10:36 ` Garg, Aksh
  2026-11-30 19:59 ` Bjorn Helgaas
  2 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-11-27 10:15 UTC (permalink / raw)
  To: Anton Protopopov, linux-pci

> 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>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127101915.1348807-1-a.s.protopopov@gmail.com?part=1

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

* [PATCH] PCI: j721e: Properly check the error of a syscon lookup
@ 2026-11-27 10:19 Anton Protopopov
  2026-11-27 10:15 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ 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 related	[flat|nested] 8+ 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:15 ` sashiko-bot
@ 2026-11-27 10:36 ` Garg, Aksh
  2026-11-30 19:59 ` Bjorn Helgaas
  2 siblings, 0 replies; 8+ 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@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

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] 8+ 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:15 ` sashiko-bot
  2026-11-27 10:36 ` Garg, Aksh
@ 2026-11-30 19:59 ` Bjorn Helgaas
  2026-11-30 20:34   ` Anton Protopopov
  2 siblings, 1 reply; 8+ messages in thread
From: Bjorn Helgaas @ 2026-11-30 19:59 UTC (permalink / raw)
  To: Anton Protopopov
  Cc: 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, Simon Glass, Ye Zhang

[+cc Simon, Ye for possible similar problems in pinctrl-rockchip.c]

On Fri, Nov 27, 2026 at 10:19:13AM +0000, 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.

"Properly" in the subject is a noise word that takes up space without
adding much value.

IIUC this avoids issues like a kernel oops when using an error pointer
(-EINVAL, etc) as a regmap pointer.

There are only five callers of syscon_regmap_lookup_by_phandle_optional()
in the tree.  wpcm_fiu_probe() looks right, and you're fixing this one.

The other three are in drivers/pinctrl/pinctrl-rockchip.c, which looks
kind of suspicious, or at least too complicated to verify at a glance.
These were added by:

  63113d4fce6c ("pinctrl: rockchip: Add RV1106 pinctrl support")
  dbd2317d7b9f ("pinctrl: rockchip: Add rk3506 pinctrl support")

> 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] 8+ messages in thread

* Re: [PATCH] PCI: j721e: Properly check the error of a syscon lookup
  2026-11-30 19:59 ` Bjorn Helgaas
@ 2026-11-30 20:34   ` Anton Protopopov
  2026-11-30 20:40     ` Bjorn Helgaas
  0 siblings, 1 reply; 8+ messages in thread
From: Anton Protopopov @ 2026-11-30 20:34 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: 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, Simon Glass, Ye Zhang

On Mon, Nov 30, 2026 at 8:59 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> [+cc Simon, Ye for possible similar problems in pinctrl-rockchip.c]
>
> On Fri, Nov 27, 2026 at 10:19:13AM +0000, 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.
>
> "Properly" in the subject is a noise word that takes up space without
> adding much value.

Yes, thanks, not needed.

> IIUC this avoids issues like a kernel oops when using an error pointer
> (-EINVAL, etc) as a regmap pointer.

I will add this to the commit description.

> There are only five callers of syscon_regmap_lookup_by_phandle_optional()
> in the tree.  wpcm_fiu_probe() looks right

Actually, I think it also stores an error and later dereferences it in
similar way. Probably should be something like

fiu->shm_regmap =
syscon_regmap_lookup_by_phandle_optional(dev->of_node, "nuvoton,shm");
+          if (IS_ERR(fiu->shm_regmap))
+                  return dev_err_probe(dev, PTR_ERR(fiu->shm_regmap),
+                                       "Failed to look up the SHM syscon\n");

> and you're fixing this one.
>
> The other three are in drivers/pinctrl/pinctrl-rockchip.c, which looks
> kind of suspicious, or at least too complicated to verify at a glance.

Yes, 2 of 3 look buggy. Should I send fixes for all of them?

> These were added by:
>
>   63113d4fce6c ("pinctrl: rockchip: Add RV1106 pinctrl support")
>   dbd2317d7b9f ("pinctrl: rockchip: Add rk3506 pinctrl support")
>
> > 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] 8+ messages in thread

* Re: [PATCH] PCI: j721e: Properly check the error of a syscon lookup
  2026-11-30 20:34   ` Anton Protopopov
@ 2026-11-30 20:40     ` Bjorn Helgaas
  2026-11-30 20:46       ` Anton Protopopov
  0 siblings, 1 reply; 8+ messages in thread
From: Bjorn Helgaas @ 2026-11-30 20:40 UTC (permalink / raw)
  To: Anton Protopopov
  Cc: 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, Simon Glass, Ye Zhang, Jonathan Neuschäfer

[+cc Jonathan for wpcm_fiu_probe()]

On Mon, Nov 30, 2026 at 09:34:00PM +0100, Anton Protopopov wrote:
> On Mon, Nov 30, 2026 at 8:59 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> >
> > [+cc Simon, Ye for possible similar problems in pinctrl-rockchip.c]
> >
> > On Fri, Nov 27, 2026 at 10:19:13AM +0000, 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.
> >
> > "Properly" in the subject is a noise word that takes up space without
> > adding much value.
> 
> Yes, thanks, not needed.
> 
> > IIUC this avoids issues like a kernel oops when using an error pointer
> > (-EINVAL, etc) as a regmap pointer.
> 
> I will add this to the commit description.
> 
> > There are only five callers of syscon_regmap_lookup_by_phandle_optional()
> > in the tree.  wpcm_fiu_probe() looks right
> 
> Actually, I think it also stores an error and later dereferences it in
> similar way. Probably should be something like
> 
> fiu->shm_regmap =
> syscon_regmap_lookup_by_phandle_optional(dev->of_node, "nuvoton,shm");
> +          if (IS_ERR(fiu->shm_regmap))
> +                  return dev_err_probe(dev, PTR_ERR(fiu->shm_regmap),
> +                                       "Failed to look up the SHM syscon\n");

Yeah, you're right.  wpcm_fiu at least checks fiu->shm_regmap for NULL
before using it, but obviously the error pointers are non-NULL, so
checking for NULL isn't enough.

> > and you're fixing this one.
> >
> > The other three are in drivers/pinctrl/pinctrl-rockchip.c, which looks
> > kind of suspicious, or at least too complicated to verify at a glance.
> 
> Yes, 2 of 3 look buggy. Should I send fixes for all of them?

Somebody should :)

> > These were added by:
> >
> >   63113d4fce6c ("pinctrl: rockchip: Add RV1106 pinctrl support")
> >   dbd2317d7b9f ("pinctrl: rockchip: Add rk3506 pinctrl support")
> >
> > > 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] 8+ messages in thread

* Re: [PATCH] PCI: j721e: Properly check the error of a syscon lookup
  2026-11-30 20:40     ` Bjorn Helgaas
@ 2026-11-30 20:46       ` Anton Protopopov
  2026-12-01 11:24         ` Anton Protopopov
  0 siblings, 1 reply; 8+ messages in thread
From: Anton Protopopov @ 2026-11-30 20:46 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: 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, Simon Glass, Ye Zhang, Jonathan Neuschäfer

On Mon, Nov 30, 2026 at 9:40 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> [+cc Jonathan for wpcm_fiu_probe()]
>
> On Mon, Nov 30, 2026 at 09:34:00PM +0100, Anton Protopopov wrote:
> > On Mon, Nov 30, 2026 at 8:59 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > >
> > > [+cc Simon, Ye for possible similar problems in pinctrl-rockchip.c]
> > >
> > > On Fri, Nov 27, 2026 at 10:19:13AM +0000, 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.
> > >
> > > "Properly" in the subject is a noise word that takes up space without
> > > adding much value.
> >
> > Yes, thanks, not needed.
> >
> > > IIUC this avoids issues like a kernel oops when using an error pointer
> > > (-EINVAL, etc) as a regmap pointer.
> >
> > I will add this to the commit description.
> >
> > > There are only five callers of syscon_regmap_lookup_by_phandle_optional()
> > > in the tree.  wpcm_fiu_probe() looks right
> >
> > Actually, I think it also stores an error and later dereferences it in
> > similar way. Probably should be something like
> >
> > fiu->shm_regmap =
> > syscon_regmap_lookup_by_phandle_optional(dev->of_node, "nuvoton,shm");
> > +          if (IS_ERR(fiu->shm_regmap))
> > +                  return dev_err_probe(dev, PTR_ERR(fiu->shm_regmap),
> > +                                       "Failed to look up the SHM syscon\n");
>
> Yeah, you're right.  wpcm_fiu at least checks fiu->shm_regmap for NULL
> before using it, but obviously the error pointers are non-NULL, so
> checking for NULL isn't enough.
>
> > > and you're fixing this one.
> > >
> > > The other three are in drivers/pinctrl/pinctrl-rockchip.c, which looks
> > > kind of suspicious, or at least too complicated to verify at a glance.
> >
> > Yes, 2 of 3 look buggy. Should I send fixes for all of them?
>
> Somebody should :)

Ok, I will send (tomorrow). Thanks for brief replies!

>
> > > These were added by:
> > >
> > >   63113d4fce6c ("pinctrl: rockchip: Add RV1106 pinctrl support")
> > >   dbd2317d7b9f ("pinctrl: rockchip: Add rk3506 pinctrl support")
> > >
> > > > 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] 8+ messages in thread

* Re: [PATCH] PCI: j721e: Properly check the error of a syscon lookup
  2026-11-30 20:46       ` Anton Protopopov
@ 2026-12-01 11:24         ` Anton Protopopov
  0 siblings, 0 replies; 8+ messages in thread
From: Anton Protopopov @ 2026-12-01 11:24 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: 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, Simon Glass, Ye Zhang, Jonathan Neuschäfer

On Mon, Nov 30, 2026 at 9:46 PM Anton Protopopov
<a.s.protopopov@gmail.com> wrote:
>
> On Mon, Nov 30, 2026 at 9:40 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> >
> > [+cc Jonathan for wpcm_fiu_probe()]
> >
> > On Mon, Nov 30, 2026 at 09:34:00PM +0100, Anton Protopopov wrote:
> > > On Mon, Nov 30, 2026 at 8:59 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > > >
> > > > [+cc Simon, Ye for possible similar problems in pinctrl-rockchip.c]
> > > >
> > > > On Fri, Nov 27, 2026 at 10:19:13AM +0000, 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.
> > > >
> > > > "Properly" in the subject is a noise word that takes up space without
> > > > adding much value.
> > >
> > > Yes, thanks, not needed.
> > >
> > > > IIUC this avoids issues like a kernel oops when using an error pointer
> > > > (-EINVAL, etc) as a regmap pointer.
> > >
> > > I will add this to the commit description.
> > >
> > > > There are only five callers of syscon_regmap_lookup_by_phandle_optional()
> > > > in the tree.  wpcm_fiu_probe() looks right
> > >
> > > Actually, I think it also stores an error and later dereferences it in
> > > similar way. Probably should be something like
> > >
> > > fiu->shm_regmap =
> > > syscon_regmap_lookup_by_phandle_optional(dev->of_node, "nuvoton,shm");
> > > +          if (IS_ERR(fiu->shm_regmap))
> > > +                  return dev_err_probe(dev, PTR_ERR(fiu->shm_regmap),
> > > +                                       "Failed to look up the SHM syscon\n");
> >
> > Yeah, you're right.  wpcm_fiu at least checks fiu->shm_regmap for NULL
> > before using it, but obviously the error pointers are non-NULL, so
> > checking for NULL isn't enough.
> >
> > > > and you're fixing this one.
> > > >
> > > > The other three are in drivers/pinctrl/pinctrl-rockchip.c, which looks
> > > > kind of suspicious, or at least too complicated to verify at a glance.
> > >
> > > Yes, 2 of 3 look buggy. Should I send fixes for all of them?
> >
> > Somebody should :)
>
> Ok, I will send (tomorrow). Thanks for brief replies!

Sent. This patch grew into two patches (the second is not related, but
fixes the same functions and sashiko was blaming my patch on this
pre-existing bug).

> [...]

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

end of thread, other threads:[~2026-12-01 11:25 UTC | newest]

Thread overview: 8+ 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:15 ` sashiko-bot
2026-11-27 10:36 ` Garg, Aksh
2026-11-30 19:59 ` Bjorn Helgaas
2026-11-30 20:34   ` Anton Protopopov
2026-11-30 20:40     ` Bjorn Helgaas
2026-11-30 20:46       ` Anton Protopopov
2026-12-01 11:24         ` 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.