summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFabrizio Castro <fabrizio.castro.jz@renesas.com>2025-03-05 16:37:50 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-13 12:53:19 +0100
commit1f59fc0d0097eef548538ddc5d9f7767862002e6 (patch)
tree40827be0d24ed877f36bbaae0c696f458a524f23 /drivers
parent09418e5946de6d7c87f8e397bd125678bd76315c (diff)
downloadlinux-1f59fc0d0097eef548538ddc5d9f7767862002e6.tar.gz
linux-1f59fc0d0097eef548538ddc5d9f7767862002e6.tar.bz2
linux-1f59fc0d0097eef548538ddc5d9f7767862002e6.zip
gpio: rcar: Fix missing of_node_put() call
[ Upstream commit 391b41f983bf7ff853de44704d8e14e7cc648a9b ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/gpio-rcar.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index fd35e4611cc6..ab200e625010 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -469,7 +469,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",