Skip to content

Commit 0a2d60e

Browse files
wensgregkh
authored andcommitted
PCI: mediatek-gen3: Prevent leaking IRQ domains when IRQ not found
[ Upstream commit 5573c44 ] 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, without cleaning up the allocated domains. Hence, 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: 814ccee ("PCI: mediatek-gen3: Add INTx support") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://sashiko.dev/#/patchset/20260324052002.4072430-1-wenst%40chromium.org Link: https://patch.msgid.link/20260324093542.18523-1-wenst@chromium.org Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent db805e9 commit 0a2d60e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/pci/controller/pcie-mediatek-gen3.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -851,14 +851,14 @@ static int mtk_pcie_setup_irq(struct mtk_gen3_pcie *pcie)
851851
struct platform_device *pdev = to_platform_device(dev);
852852
int err;
853853

854-
err = mtk_pcie_init_irq_domains(pcie);
855-
if (err)
856-
return err;
857-
858854
pcie->irq = platform_get_irq(pdev, 0);
859855
if (pcie->irq < 0)
860856
return pcie->irq;
861857

858+
err = mtk_pcie_init_irq_domains(pcie);
859+
if (err)
860+
return err;
861+
862862
irq_set_chained_handler_and_data(pcie->irq, mtk_pcie_irq_handler, pcie);
863863

864864
return 0;

0 commit comments

Comments
 (0)