mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PCI: mt7621: Fix reset control leak on PHY initialization failure
@ 2026-11-01  7:01 Sreeraj S Kurup
  2026-11-01  8:57 ` Sergio Paracuellos
  2026-11-07 17:06 ` Manivannan Sadhasivam
  0 siblings, 2 replies; 4+ messages in thread
From: Sreeraj S Kurup @ 2026-11-01  7:01 UTC (permalink / raw)
  To: sergio.paracuellos, lpieralisi, kwilczynski, mani, robh,
	bhelgaas, matthias.bgg, angelogioacchino.delregno, p.zabel
  Cc: linux-pci, linux-kernel, linux-arm-kernel, linux-mediatek,
	Sreeraj S Kurup

The PCIe port initialization code acquires a reset control handle using
of_reset_control_get_exclusive(). However, when PHY initialization or
power-on fails, the port is removed from the PCIe port list without
releasing the acquired reset control handle.

Since the reset control cleanup iterates over the remaining ports in
the list, the removed port's reset control handle is never released.

Call reset_control_put() before removing the failed port from the list
to ensure that the reset control resource is properly released.

Fixes a resource leak on PCIe PHY initialization failure.

Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
 drivers/pci/controller/pcie-mt7621.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/pcie-mt7621.c
index 01ead2f92e87..1dcaa2829609 100644
--- a/drivers/pci/controller/pcie-mt7621.c
+++ b/drivers/pci/controller/pcie-mt7621.c
@@ -361,6 +361,7 @@ static int mt7621_pcie_init_ports(struct mt7621_pcie *pcie)
 		err = mt7621_pcie_init_port(port);
 		if (err) {
 			dev_err(dev, "initializing port %d failed\n", slot);
+			reset_control_put(port->pcie_rst);
 			list_del(&port->list);
 		}
 	}
-- 
2.55.0


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

* Re: [PATCH] PCI: mt7621: Fix reset control leak on PHY initialization failure
  2026-11-01  7:01 [PATCH] PCI: mt7621: Fix reset control leak on PHY initialization failure Sreeraj S Kurup
@ 2026-11-01  8:57 ` Sergio Paracuellos
  2026-11-07 17:06 ` Manivannan Sadhasivam
  1 sibling, 0 replies; 4+ messages in thread
From: Sergio Paracuellos @ 2026-11-01  8:57 UTC (permalink / raw)
  To: Sreeraj S Kurup
  Cc: lpieralisi, kwilczynski, mani, robh, bhelgaas, matthias.bgg,
	angelogioacchino.delregno, p.zabel, linux-pci, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Sun, Nov 1, 2026 at 8:02 AM Sreeraj S Kurup
<sreekuttan2156239@gmail.com> wrote:
>
> The PCIe port initialization code acquires a reset control handle using
> of_reset_control_get_exclusive(). However, when PHY initialization or
> power-on fails, the port is removed from the PCIe port list without
> releasing the acquired reset control handle.
>
> Since the reset control cleanup iterates over the remaining ports in
> the list, the removed port's reset control handle is never released.
>
> Call reset_control_put() before removing the failed port from the list
> to ensure that the reset control resource is properly released.
>
> Fixes a resource leak on PCIe PHY initialization failure.
>
> Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
> ---
>  drivers/pci/controller/pcie-mt7621.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>

Thanks,
    Sergio Paracuellos

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

* Re: [PATCH] PCI: mt7621: Fix reset control leak on PHY initialization failure
  2026-11-01  7:01 [PATCH] PCI: mt7621: Fix reset control leak on PHY initialization failure Sreeraj S Kurup
  2026-11-01  8:57 ` Sergio Paracuellos
@ 2026-11-07 17:06 ` Manivannan Sadhasivam
  2026-11-08  9:09   ` Sreeraj S Kurup
  1 sibling, 1 reply; 4+ messages in thread
From: Manivannan Sadhasivam @ 2026-11-07 17:06 UTC (permalink / raw)
  To: sergio.paracuellos, lpieralisi, kwilczynski, robh, bhelgaas,
	matthias.bgg, angelogioacchino.delregno, p.zabel,
	Sreeraj S Kurup
  Cc: linux-pci, linux-kernel, linux-arm-kernel, linux-mediatek


On Sun, 01 Nov 2026 07:01:21 +0000, Sreeraj S Kurup wrote:
> The PCIe port initialization code acquires a reset control handle using
> of_reset_control_get_exclusive(). However, when PHY initialization or
> power-on fails, the port is removed from the PCIe port list without
> releasing the acquired reset control handle.
> 
> Since the reset control cleanup iterates over the remaining ports in
> the list, the removed port's reset control handle is never released.
> 
> [...]

Applied, thanks!

[1/1] PCI: mt7621: Fix reset control leak on PHY initialization failure
      commit: 1973b0f280bb753e0810346a9377766c38230752

Best regards,
-- 
மணிவண்ணன் சதாசிவம்



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

* Re: [PATCH] PCI: mt7621: Fix reset control leak on PHY initialization failure
  2026-11-07 17:06 ` Manivannan Sadhasivam
@ 2026-11-08  9:09   ` Sreeraj S Kurup
  0 siblings, 0 replies; 4+ messages in thread
From: Sreeraj S Kurup @ 2026-11-08  9:09 UTC (permalink / raw)
  To: mani
  Cc: angelogioacchino.delregno, bhelgaas, kwilczynski,
	linux-arm-kernel, linux-kernel, linux-mediatek, linux-pci,
	lpieralisi, matthias.bgg, p.zabel, robh, sergio.paracuellos,
	sreekuttan2156239

Hi,

Thanks for applying the patch!

Best regards,
Sreeraj

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

end of thread, other threads:[~2026-11-08  9:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-01  7:01 [PATCH] PCI: mt7621: Fix reset control leak on PHY initialization failure Sreeraj S Kurup
2026-11-01  8:57 ` Sergio Paracuellos
2026-11-07 17:06 ` Manivannan Sadhasivam
2026-11-08  9:09   ` Sreeraj S Kurup

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®