]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: rcar: Fix missing of_node_put() call
authorFabrizio Castro <fabrizio.castro.jz@renesas.com>
Wed, 5 Mar 2025 16:37:50 +0000 (16:37 +0000)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 6 Mar 2025 14:51:27 +0000 (15:51 +0100)
of_parse_phandle_with_fixed_args() requires its caller to
call into of_node_put() on the node pointer from the output
structure, but such a call is currently missing.

Call into of_node_put() to rectify that.

Fixes: 159f8a0209af ("gpio-rcar: Add DT support")
Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20250305163753.34913-2-fabrizio.castro.jz@renesas.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-rcar.c

index 8e0544e9248866e80def8cdcc44fb2bef9b6f833..a7a1cdf7ac66d38597973b99ac7c69b1fb65db8a 100644 (file)
@@ -468,7 +468,12 @@ static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
        p->info = *info;
 
        ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args);
-       *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK;
+       if (ret) {
+               *npins = RCAR_MAX_GPIO_PER_BANK;
+       } else {
+               *npins = args.args[2];
+               of_node_put(args.np);
+       }
 
        if (*npins == 0 || *npins > RCAR_MAX_GPIO_PER_BANK) {
                dev_warn(p->dev, "Invalid number of gpio lines %u, using %u\n",