Skip to contentSkip to conversation

gpio: sifive: Fix refcount leak in sifive_gpio_probe

PATCH In review Miaoqian Lin 2 participants 2 messages Jan 2, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: sifive: Fix refcount leak in sifive_gpio_probe

of_irq_find_parent() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore. Add missing of_node_put() to avoid refcount leak.

Fixes 96868dce644d ("gpio/sifive: Add GPIO driver for SiFive SoCs")
---
 drivers/gpio/gpio-sifive.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpio/gpio-sifive.c +1 -0
index 238f3210970c..bc5660f61c57 100644
@@ -215,6 +215,7 @@ static int sifive_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 	parent = irq_find_host(irq_parent);
+	of_node_put(irq_parent);
 	if (!parent) {
 		dev_err(dev, "no IRQ parent domain\n");
 		return -ENODEV;
Signature · 7 lines
2.25.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw
Quoted 24 lines · Miaoqian Lin

of_irq_find_parent() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore. Add missing of_node_put() to avoid refcount leak.

Fixes 96868dce644d ("gpio/sifive: Add GPIO driver for SiFive SoCs")
---
 drivers/gpio/gpio-sifive.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpio/gpio-sifive.c +1 -1
index 238f3210970c..bc5660f61c57 100644
@@ -215,6 +215,7 @@ static int sifive_gpio_probe(struct platform_device *pdev)
                return -ENODEV;
        }
        parent = irq_find_host(irq_parent);
+       of_node_put(irq_parent);
        if (!parent) {
                dev_err(dev, "no IRQ parent domain\n");
                return -ENODEV;
--
Quoted 2 lines

2.25.1

Good catch, applied!

Bart

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv