diff mbox series

[2/3] PCI: aardvark: Dispose bridge irq prior to removing bridge domain

Message ID 20220711120626.11492-2-pali@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/3] PCI: aardvark: Dispose INTx irqs prior to removing INTx domain | expand

Commit Message

Pali Rohár July 11, 2022, 12:06 p.m. UTC
Documentation for irq_domain_remove() says that all mapping within the
domain must be disposed prior to domain remove.

Currently bridge irq is not disposed in pci-aardvark.c device unbind callback
which cause that kernel crashes after unloading driver and trying to read
/sys/kernel/debug/irq/irqs/<num> or /proc/interrupts.

Fixes: 815bc3136867 ("PCI: aardvark: Use separate INTA interrupt for emulated root bridge")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/pci/controller/pci-aardvark.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index 6cb65e64859d..8bea5801d50a 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1479,6 +1479,12 @@  static int advk_pcie_init_rp_irq_domain(struct advk_pcie *pcie)
 
 static void advk_pcie_remove_rp_irq_domain(struct advk_pcie *pcie)
 {
+	int virq;
+
+	virq = irq_find_mapping(pcie->rp_irq_domain, 0);
+	if (virq > 0)
+		irq_dispose_mapping(virq);
+
 	irq_domain_remove(pcie->rp_irq_domain);
 }