mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
PCI: mediatek-gen3: Prevent leaking IRQ domains when IRQ not found
[ Upstream commit5573c44cb3] 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:814cceebba("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0afb2eca25
commit
07a5ecb947
@@ -760,14 +760,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;
|
||||
|
||||
Reference in New Issue
Block a user