]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
irqchip: i8259: Add domain before mapping parent irq
authorPaul Burton <paul.burton@imgtec.com>
Mon, 19 Sep 2016 21:21:18 +0000 (22:21 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 6 Oct 2016 15:30:59 +0000 (17:30 +0200)
Mapping the parent IRQ will use a virq number which may conflict with
the hardcoded I8259A_IRQ_BASE..I8259A_IRQ_BASE+15 range that the i8259
driver expects to be free. If this occurs then we'll hit errors when
adding the i8259 IRQ domain, since one of its virq numbers will already
be in use.

Avoid this by adding the i8259 domain before mapping the parent IRQ,
such that the i8259 virq numbers become used before the parent interrupt
controller gets a chance to use any of them.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14269/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
drivers/irqchip/irq-i8259.c

index 6b304eb39bd22c96b64c6a99629ef4195db721b5..85897fdc15273f36921428de146a03f279c84de0 100644 (file)
@@ -370,13 +370,15 @@ int __init i8259_of_init(struct device_node *node, struct device_node *parent)
        struct irq_domain *domain;
        unsigned int parent_irq;
 
+       domain = __init_i8259_irqs(node);
+
        parent_irq = irq_of_parse_and_map(node, 0);
        if (!parent_irq) {
                pr_err("Failed to map i8259 parent IRQ\n");
+               irq_domain_remove(domain);
                return -ENODEV;
        }
 
-       domain = __init_i8259_irqs(node);
        irq_set_chained_handler_and_data(parent_irq, i8259_irq_dispatch,
                                         domain);
        return 0;