mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 v2] PCI: mt7621: Release port reset controls on host registration failure
Date: Thu,  3 Dec 2026 22:51:20 +0800	[thread overview]
Message-ID: <179630907465.68028.13430770028885227002.mt7621-v2@gmail.com> (raw)

mt7621_pcie_parse_port() takes an exclusive reset control for each
root port. If pci_host_probe() fails, mt7621_pcie_probe() returns the
error from mt7621_pcie_register_host() without releasing the reset
controls for the ports on pcie->ports. A subsequent probe can then
fail to acquire those controls.

Use the existing remove_resets path on host registration failure to
release the controls and return the original error.

Fixes: 2bdd5238e756 ("PCI: mt7621: Add MediaTek MT7621 PCIe host controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Changes in v2:
- Drop the change to the device tree parsing error path, as requested
  by Sergio Paracuellos.

v1: https://lore.kernel.org/r/rc-b1-20261110-vc-184-61b6257957f3@gmail.com/
Review: https://lore.kernel.org/r/CAMhs-H_Yd4L9jyYvH+BJy5BDSPO8AQy6X5vFFaR50eqS_UxAkw@mail.gmail.com/

 drivers/pci/controller/pcie-mt7621.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/pcie-mt7621.c
index 79f973f8a605..9ee0961ef050 100644
--- a/drivers/pci/controller/pcie-mt7621.c
+++ b/drivers/pci/controller/pcie-mt7621.c
@@ -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

             reply	other threads:[~2026-12-03 14:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 14:51 Yige Jiang [this message]
2026-12-03 14:54 ` Sergio Paracuellos

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=179630907465.68028.13430770028885227002.mt7621-v2@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®