]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pinctrl: renesas: rzt2h: Fix device node leak in rzt2h_gpio_register()
authorFelix Gu <ustc.gu@gmail.com>
Mon, 26 Jan 2026 16:35:47 +0000 (00:35 +0800)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 6 Mar 2026 12:28:34 +0000 (13:28 +0100)
When calling of_parse_phandle_with_fixed_args(), the caller is
responsible for calling of_node_put() to release the device node
reference.

In rzt2h_gpio_register(), the driver fails to call of_node_put() to
release the reference in of_args.np, which causes a memory leak.

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

Fixes: 34d4d093077a ("pinctrl: renesas: Add support for RZ/T2H")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20260127-rzt2h-v1-1-86472e7421b8@gmail.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
drivers/pinctrl/renesas/pinctrl-rzt2h.c

index 9949108a35bbc3730e77d5350a13315b47f04f1f..5e0586d45cb74c7af279fcae1bd88325096d6f02 100644 (file)
@@ -833,6 +833,7 @@ static int rzt2h_gpio_register(struct rzt2h_pinctrl *pctrl)
        if (ret)
                return dev_err_probe(dev, ret, "Unable to parse gpio-ranges\n");
 
+       of_node_put(of_args.np);
        if (of_args.args[0] != 0 || of_args.args[1] != 0 ||
            of_args.args[2] != pctrl->data->n_port_pins)
                return dev_err_probe(dev, -EINVAL,