diff mbox series

[1/3] PCI: aardvark: Dispose INTx irqs prior to removing INTx domain

Message ID 20220711120626.11492-1-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 INTx irqs are 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: 526a76991b7b ("PCI: aardvark: Implement driver 'remove' function and allow to build it as module")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/pci/controller/pci-aardvark.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index ffec82c8a523..6cb65e64859d 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1433,6 +1433,14 @@  static int advk_pcie_init_irq_domain(struct advk_pcie *pcie)
 
 static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie)
 {
+	int virq, i;
+
+	for (i = 0; i < PCI_NUM_INTX; i++) {
+		virq = irq_find_mapping(pcie->irq_domain, i);
+		if (virq > 0)
+			irq_dispose_mapping(virq);
+	}
+
 	irq_domain_remove(pcie->irq_domain);
 }