mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PCI: imx6: Fix device node reference leak in imx_pcie_probe()
@ 2026-01-23 18:18 Felix Gu
  2026-01-23 19:32 ` Frank Li
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Gu @ 2026-01-23 18:18 UTC (permalink / raw)
  To: Richard Zhu, Lucas Stach, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Trent Piepho
  Cc: linux-pci, linux-arm-kernel, imx, linux-kernel, Felix Gu

In imx_pcie_probe, np is obtained by of_parse_phandle() and must
be released with of_node_put() when it is no longer needed.
Add the missing of_node_put() after of_address_to_resource() to fix the
leak.

Fixes: 1df82ec46600 ("PCI: imx: Add workaround for e10728, IMX7d PCIe PLL failure")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 1d8677d7de04..3ae02712d3f0 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1675,6 +1675,7 @@ static int imx_pcie_probe(struct platform_device *pdev)
 		struct resource res;
 
 		ret = of_address_to_resource(np, 0, &res);
+		of_node_put(np);
 		if (ret) {
 			dev_err(dev, "Unable to map PCIe PHY\n");
 			return ret;

---
base-commit: a0c666c25aeefd16f4b088c6549a6fb6b65a8a1d
change-id: 20260124-pci_imx6-f97d70887dfc

Best regards,
-- 
Felix Gu <ustc.gu@gmail.com>


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

* Re: [PATCH] PCI: imx6: Fix device node reference leak in imx_pcie_probe()
  2026-01-23 18:18 [PATCH] PCI: imx6: Fix device node reference leak in imx_pcie_probe() Felix Gu
@ 2026-01-23 19:32 ` Frank Li
  2026-01-24 13:10   ` Felix Gu
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Li @ 2026-01-23 19:32 UTC (permalink / raw)
  To: Felix Gu
  Cc: Richard Zhu, Lucas Stach, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Trent Piepho, linux-pci, linux-arm-kernel, imx,
	linux-kernel

On Sat, Jan 24, 2026 at 02:18:49AM +0800, Felix Gu wrote:
> In imx_pcie_probe, np is obtained by of_parse_phandle() and must
> be released with of_node_put() when it is no longer needed.
> Add the missing of_node_put() after of_address_to_resource() to fix the
> leak.
>
> Fixes: 1df82ec46600 ("PCI: imx: Add workaround for e10728, IMX7d PCIe PLL failure")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
>  drivers/pci/controller/dwc/pci-imx6.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 1d8677d7de04..3ae02712d3f0 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1675,6 +1675,7 @@ static int imx_pcie_probe(struct platform_device *pdev)
>  		struct resource res;
>

Please use auto cleanup

	struct device_node *np __free(device_node) =
		of_parse_phandle(node, "fsl,imx7d-pcie-phy", 0);

Frank

>  		ret = of_address_to_resource(np, 0, &res);
> +		of_node_put(np);
>  		if (ret) {
>  			dev_err(dev, "Unable to map PCIe PHY\n");
>  			return ret;
>
> ---
> base-commit: a0c666c25aeefd16f4b088c6549a6fb6b65a8a1d
> change-id: 20260124-pci_imx6-f97d70887dfc
>
> Best regards,
> --
> Felix Gu <ustc.gu@gmail.com>
>

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

* Re: [PATCH] PCI: imx6: Fix device node reference leak in imx_pcie_probe()
  2026-01-23 19:32 ` Frank Li
@ 2026-01-24 13:10   ` Felix Gu
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Gu @ 2026-01-24 13:10 UTC (permalink / raw)
  To: Frank Li
  Cc: Richard Zhu, Lucas Stach, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Trent Piepho, linux-pci, linux-arm-kernel, imx,
	linux-kernel

On Sat, Jan 24, 2026 at 3:32 AM Frank Li <Frank.li@nxp.com> wrote:
>
> On Sat, Jan 24, 2026 at 02:18:49AM +0800, Felix Gu wrote:
> > In imx_pcie_probe, np is obtained by of_parse_phandle() and must
> > be released with of_node_put() when it is no longer needed.
> > Add the missing of_node_put() after of_address_to_resource() to fix the
> > leak.
> >
> > Fixes: 1df82ec46600 ("PCI: imx: Add workaround for e10728, IMX7d PCIe PLL failure")
> > Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> > ---
> >  drivers/pci/controller/dwc/pci-imx6.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> > index 1d8677d7de04..3ae02712d3f0 100644
> > --- a/drivers/pci/controller/dwc/pci-imx6.c
> > +++ b/drivers/pci/controller/dwc/pci-imx6.c
> > @@ -1675,6 +1675,7 @@ static int imx_pcie_probe(struct platform_device *pdev)
> >               struct resource res;
> >
>
> Please use auto cleanup
>
>         struct device_node *np __free(device_node) =
>                 of_parse_phandle(node, "fsl,imx7d-pcie-phy", 0);
>
> Frank
Hi Frank,
Thanks for the review, I will fix it in V2.

Best regards,
Felix Gu
>
> >               ret = of_address_to_resource(np, 0, &res);
> > +             of_node_put(np);
> >               if (ret) {
> >                       dev_err(dev, "Unable to map PCIe PHY\n");
> >                       return ret;
> >
> > ---
> > base-commit: a0c666c25aeefd16f4b088c6549a6fb6b65a8a1d
> > change-id: 20260124-pci_imx6-f97d70887dfc
> >
> > Best regards,
> > --
> > Felix Gu <ustc.gu@gmail.com>
> >

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-23 18:18 [PATCH] PCI: imx6: Fix device node reference leak in imx_pcie_probe() Felix Gu
2026-01-23 19:32 ` Frank Li
2026-01-24 13:10   ` Felix Gu

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®