Skip to content

Commit 07a5ecb

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 0afb2ec commit 07a5ecb

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
@@ -760,14 +760,14 @@ static int mtk_pcie_setup_irq(struct mtk_gen3_pcie *pcie)
760760
struct platform_device *pdev = to_platform_device(dev);
761761
int err;
762762

763-
err = mtk_pcie_init_irq_domains(pcie);
764-
if (err)
765-
return err;
766-
767763
pcie->irq = platform_get_irq(pdev, 0);
768764
if (pcie->irq < 0)
769765
return pcie->irq;
770766

767+
err = mtk_pcie_init_irq_domains(pcie);
768+
if (err)
769+
return err;
770+
771771
irq_set_chained_handler_and_data(pcie->irq, mtk_pcie_irq_handler, pcie);
772772

773773
return 0;

0 commit comments

Comments
 (0)