1 From 2f040a17f5061457ae95035326d3159eddc1e5cc Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
3 Date: Tue, 30 Nov 2021 18:29:10 +0100
4 Subject: [PATCH] PCI: aardvark: Fix memory leak in driver unbind
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Free config space for emulated root bridge when unbinding driver to fix
10 memory leak. Do it after disabling and masking all interrupts, since
11 aardvark interrupt handler accesses config space of emulated root
14 Link: https://lore.kernel.org/r/20211130172913.9727-9-kabel@kernel.org
15 Signed-off-by: Pali Rohár <pali@kernel.org>
16 Signed-off-by: Marek Behún <kabel@kernel.org>
17 Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
19 drivers/pci/controller/pci-aardvark.c | 3 +++
20 1 file changed, 3 insertions(+)
22 diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
23 index 08b34accfe2f..b3d89cb449b6 100644
24 --- a/drivers/pci/controller/pci-aardvark.c
25 +++ b/drivers/pci/controller/pci-aardvark.c
26 @@ -1734,6 +1734,9 @@ static int advk_pcie_remove(struct platform_device *pdev)
27 advk_pcie_remove_msi_irq_domain(pcie);
28 advk_pcie_remove_irq_domain(pcie);
30 + /* Free config space for emulated root bridge */
31 + pci_bridge_emul_cleanup(&pcie->bridge);
33 /* Disable outbound address windows mapping */
34 for (i = 0; i < OB_WIN_COUNT; i++)
35 advk_pcie_disable_ob_win(pcie, i);