From: Yige Jiang <yigejiang86@gmail.com>
To: "Sergio Paracuellos" <sergio.paracuellos@gmail.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>
Cc: Yige Jiang <yigejiang86@gmail.com>, Rob Herring <robh@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, stable@vger.kernel.org
Subject: [PATCH] PCI: mt7621: Release port reset controls on probe failure
Date: Thu, 3 Dec 2026 18:42:38 +0800 [thread overview]
Message-ID: <rc-b1-20261110-vc-184-61b6257957f3@gmail.com> (raw)
mt7621_pcie_parse_port() takes an exclusive reset control for each
root port and adds the port to pcie->ports. If a later port then fails
to parse, for instance because its PHY or reset GPIO returns
-EPROBE_DEFER, mt7621_pcie_probe() returns without putting the reset
controls of the ports already on the list. A failure of
mt7621_pcie_register_host() returns without putting them as well.
On the next probe attempt, of_reset_control_get_exclusive() for an
earlier port finds its reset control still acquired, warns and returns
-EBUSY. mt7621_pcie_parse_port() only treats -EPROBE_DEFER as fatal, so
probe continues with an error pointer as that port's reset control, and
the later assert and deassert calls warn and fail.
Jump to remove_resets in both cases, as the mt7621_pcie_enable_ports()
failure path already does.
Fixes: 2bdd5238e756 ("PCI: mt7621: Add MediaTek MT7621 PCIe host controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Based on linux-next next-20261109 (630059a5a632).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_PCIE_MT7621=y, COMPILE_TEST=y; baseline and patched pcie-mt7621.o, no new warnings.
No hardware or runtime test was performed.
Hit when a later root port's PHY or reset GPIO defers (or its DT node is malformed) after an earlier port took its reset, or when pci_host_probe() fails.
Independent of Sreeraj S Kurup's "PCI: mt7621: Fix reset control leak on PHY initialization failure" (now in linux-next as db7c929526a3), which covers the mt7621_pcie_init_ports() path; this patch applies on top of it (checked against next-20261111).
drivers/pci/controller/pcie-mt7621.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/pcie-mt7621.c
index 79f973f8a605..2e5f42cbefb0 100644
--- a/drivers/pci/controller/pcie-mt7621.c
+++ b/drivers/pci/controller/pcie-mt7621.c
@@ -495,7 +495,7 @@ static int mt7621_pcie_probe(struct platform_device *pdev)
err = mt7621_pcie_parse_dt(pcie);
if (err) {
dev_err(dev, "parsing DT failed\n");
- return err;
+ goto remove_resets;
}
err = mt7621_pcie_init_ports(pcie);
@@ -510,7 +510,11 @@ static int mt7621_pcie_probe(struct platform_device *pdev)
goto remove_resets;
}
- return mt7621_pcie_register_host(bridge);
+ err = mt7621_pcie_register_host(bridge);
+ if (err)
+ goto remove_resets;
+
+ return 0;
remove_resets:
list_for_each_entry(port, &pcie->ports, list)
base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47
next reply other threads:[~2026-12-03 10:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 10:42 Yige Jiang [this message]
2026-12-03 14:20 ` Sergio Paracuellos
2026-12-03 14:52 ` Yige Jiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=rc-b1-20261110-vc-184-61b6257957f3@gmail.com \
--to=yigejiang86@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bhelgaas@google.com \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=sergio.paracuellos@gmail.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®