irqchip/atmel-aic: Fix unbalanced refcount in aic_common_rtc_irq_fixup()
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 4 Jul 2017 09:10:40 +0000 (11:10 +0200)
committerMarc Zyngier <marc.zyngier@arm.com>
Tue, 4 Jul 2017 10:10:36 +0000 (11:10 +0100)
of_find_compatible_node() is calling of_node_put() on its first argument
thus leading to an unbalanced of_node_get/put() issue if the node has not
been retained before that.

Instead of passing the root node, pass NULL, which does exactly the same:
iterate over all DT nodes, starting from the root node.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reported-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Fixes: 3d61467f9bab ("irqchip: atmel-aic: Implement RTC irq fixup")
Cc: <stable@vger.kernel.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
drivers/irqchip/irq-atmel-aic-common.c

index 7c5a43488d27d1a516c8b7b22af907ed77c3c0ca..0565070997256647c0900421b2188230e39f4f82 100644 (file)
@@ -142,9 +142,9 @@ void __init aic_common_rtc_irq_fixup(struct device_node *root)
        struct device_node *np;
        void __iomem *regs;
 
-       np = of_find_compatible_node(root, NULL, "atmel,at91rm9200-rtc");
+       np = of_find_compatible_node(NULL, NULL, "atmel,at91rm9200-rtc");
        if (!np)
-               np = of_find_compatible_node(root, NULL,
+               np = of_find_compatible_node(NULL, NULL,
                                             "atmel,at91sam9x5-rtc");
 
        if (!np)