Skip to contentSkip to conversation

pinctrl: equilibrium: Fix device node reference leak in pinbank_init()

PATCH In review Felix Gu 3 participants 3 messages Jan 26 – Jan 28

Subsystems (2)
lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH 1/1 pinctrl: equilibrium: Fix device node reference leak in pinbank_init()

When calling of_parse_phandle_with_fixed_args(), the caller is responsible to call of_node_put() to release the reference of device node.

In pinbank_init(), the reference of the node obtained from the "gpio-ranges" property is never released, resulting in a reference count leak.

Add the missing of_node_put() call to fix the leak.

Fixes 1948d5c51dba ("pinctrl: Add pinmux & GPIO controller driver for a new SoC")
---
 drivers/pinctrl/pinctrl-equilibrium.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pinctrl/pinctrl-equilibrium.c +1 -0
index 2d04829b29c9..48b55c5bf8d4 100644
@@ -846,6 +846,7 @@ static int pinbank_init(struct device_node *np,
 
 	bank->pin_base = spec.args[1];
 	bank->nr_pins = spec.args[2];
+	of_node_put(spec.np);
 
 	bank->aval_pinmap = readl(bank->membase + REG_AVAIL);
 	bank->id = id;

---
base-commit: ca3a02fda4da8e2c1cb6baee5d72352e9e2cfaea
change-id: 20260127-pinctrl-equilibrium-7cabc99b86ff

Best regards,

Signature · 1 line
Felix Gu <[email protected]>
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Felix Gu

When calling of_parse_phandle_with_fixed_args(), the caller is responsible to call of_node_put() to release the reference of device node.

In pinbank_init(), the reference of the node obtained from the "gpio-ranges" property is never released, resulting in a reference count leak.

Add the missing of_node_put() call to fix the leak.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#2 lore raw
In reply to Felix Gu
Quoted 4 lines · Felix Gu

When calling of_parse_phandle_with_fixed_args(), the caller is responsible to call of_node_put() to release the reference of device node.

Quoted 8 lines

In pinbank_init(), the reference of the node obtained from the "gpio-ranges" property is never released, resulting in a reference count leak.

Add the missing of_node_put() call to fix the leak.

Fixes 1948d5c51dba ("pinctrl: Add pinmux & GPIO controller driver for a new SoC")

Patch applied!

Yours,
Linus Walleij