Skip to content

Commit 5897eaa

Browse files
Fabrizio Castrogregkh
Fabrizio Castro
authored andcommitted
gpio: rcar: Fix missing of_node_put() call
[ Upstream commit 391b41f ] 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: 159f8a0 ("gpio-rcar: Add DT support") Signed-off-by: Fabrizio Castro <[email protected]> Reviewed-by: Lad Prabhakar <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent a183937 commit 5897eaa

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/gpio/gpio-rcar.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,12 @@ static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
468468
p->info = *info;
469469

470470
ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args);
471-
*npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK;
471+
if (ret) {
472+
*npins = RCAR_MAX_GPIO_PER_BANK;
473+
} else {
474+
*npins = args.args[2];
475+
of_node_put(args.np);
476+
}
472477

473478
if (*npins == 0 || *npins > RCAR_MAX_GPIO_PER_BANK) {
474479
dev_warn(p->dev, "Invalid number of gpio lines %u, using %u\n",

0 commit comments

Comments
 (0)