Skip to contentSkip to conversation

PCI: mediatek-gen3: prevent leaking IRQ domains when IRQ not found

PATCH Applied Chen-Yu Tsai 2 participants 2 messages Mar 24 – Apr 4

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: mediatek-gen3: prevent leaking IRQ domains when IRQ not found

In mtk_pcie_setup_irq(), the IRQ domains are allocated before the controller's IRQ is fetched. If the latter fails the function directly returns an error.

Instead, reverse the order so that the IRQ domains are allocated after the controller's IRQ is found.

This was flagged by Sashiko during a review of "[PATCH v6 0/7] PCI:
mediatek-gen3: add power control support".

Fixes 814cceebba9b ("PCI: mediatek-gen3: Add INTx support")

---
This was flagged by Sashiko during a review of "[PATCH v6 0/7] PCI:
mediatek-gen3: add power control support", but is otherwise unrelated to that series and can be merged independently.

 drivers/pci/controller/pcie-mediatek-gen3.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/controller/pcie-mediatek-gen3.c +4 -4
index a94fdbaf47fe..2f9365930d6a 100644
@@ -890,14 +890,14 @@ static int mtk_pcie_setup_irq(struct mtk_gen3_pcie *pcie)
 	struct platform_device *pdev = to_platform_device(dev);
 	int err;
 
-	err = mtk_pcie_init_irq_domains(pcie);
-	if (err)
-		return err;
-
 	pcie->irq = platform_get_irq(pdev, 0);
 	if (pcie->irq < 0)
 		return pcie->irq;
 
+	err = mtk_pcie_init_irq_domains(pcie);
+	if (err)
+		return err;
+
 	irq_set_chained_handler_and_data(pcie->irq, mtk_pcie_irq_handler, pcie);
 
 	return 0;
Signature · 1 line
2.53.0.983.g0bb29b3bc5-goog
#1 lore raw
Quoted 8 lines · Chen-Yu Tsai

In mtk_pcie_setup_irq(), the IRQ domains are allocated before the controller's IRQ is fetched. If the latter fails the function directly returns an error.

Instead, reverse the order so that the IRQ domains are allocated after the controller's IRQ is found.

[...]

Applied, thanks!

[1/1] PCI: mediatek-gen3: prevent leaking IRQ domains when IRQ not found

      commit: 5573c44cb3fd01a9f62d569ae9ac870ef5f0e0ba

Best regards,

Signature · 1 line
Manivannan Sadhasivam <[email protected]>