public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: equilibrium: Fix device node reference leak in pinbank_init()
@ 2026-01-26 17:30 Felix Gu
  2026-01-27  8:48 ` Andy Shevchenko
  2026-01-28  7:56 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Felix Gu @ 2026-01-26 17:30 UTC (permalink / raw)
  To: Linus Walleij, Rahul Tanwar, Andy Shevchenko
  Cc: linux-gpio, linux-kernel, 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.

Fixes: 1948d5c51dba ("pinctrl: Add pinmux & GPIO controller driver for a new SoC")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/pinctrl/pinctrl-equilibrium.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c
index 2d04829b29c9..48b55c5bf8d4 100644
--- a/drivers/pinctrl/pinctrl-equilibrium.c
+++ b/drivers/pinctrl/pinctrl-equilibrium.c
@@ -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,
-- 
Felix Gu <ustc.gu@gmail.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: equilibrium: Fix device node reference leak in pinbank_init()
  2026-01-26 17:30 [PATCH] pinctrl: equilibrium: Fix device node reference leak in pinbank_init() Felix Gu
@ 2026-01-27  8:48 ` Andy Shevchenko
  2026-01-28  7:56 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2026-01-27  8:48 UTC (permalink / raw)
  To: Felix Gu; +Cc: Linus Walleij, Rahul Tanwar, linux-gpio, linux-kernel

On Tue, Jan 27, 2026 at 01:30:07AM +0800, Felix Gu wrote:
> 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.

Acked-by: Andy Shevchenko <andriy.shevchenko@intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: equilibrium: Fix device node reference leak in pinbank_init()
  2026-01-26 17:30 [PATCH] pinctrl: equilibrium: Fix device node reference leak in pinbank_init() Felix Gu
  2026-01-27  8:48 ` Andy Shevchenko
@ 2026-01-28  7:56 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2026-01-28  7:56 UTC (permalink / raw)
  To: Felix Gu; +Cc: Rahul Tanwar, Andy Shevchenko, linux-gpio, linux-kernel

On Mon, Jan 26, 2026 at 6:30 PM Felix Gu <ustc.gu@gmail.com> wrote:

> 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")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-28  7:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-26 17:30 [PATCH] pinctrl: equilibrium: Fix device node reference leak in pinbank_init() Felix Gu
2026-01-27  8:48 ` Andy Shevchenko
2026-01-28  7:56 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox