Skip to content

Commit e56aa18

Browse files
outman119linusw
authored andcommitted
pinctrl: meson: amlogic-a4: Fix device node reference leak in bank helpers
of_parse_phandle_with_fixed_args() increments the reference count of the returned device node, so it must be explicitly released using of_node_put() after use. Fix the reference leak in aml_bank_pins() and aml_bank_number() by adding the missing of_node_put() calls. Fixes: 6e9be3a ("pinctrl: Add driver support for Amlogic SoCs") Signed-off-by: Felix Gu <ustc.gu@gmail.com> Reviewed-by: Xianwei Zhao <xianwei.zhao@amlogic.com> Signed-off-by: Linus Walleij <linusw@kernel.org>
1 parent eabf273 commit e56aa18

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

drivers/pinctrl/meson/pinctrl-amlogic-a4.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,9 @@ static u32 aml_bank_pins(struct device_node *np)
725725
if (of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3,
726726
0, &of_args))
727727
return 0;
728-
else
729-
return of_args.args[2];
728+
729+
of_node_put(of_args.np);
730+
return of_args.args[2];
730731
}
731732

732733
static int aml_bank_number(struct device_node *np)
@@ -736,8 +737,9 @@ static int aml_bank_number(struct device_node *np)
736737
if (of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3,
737738
0, &of_args))
738739
return -EINVAL;
739-
else
740-
return of_args.args[1] >> 8;
740+
741+
of_node_put(of_args.np);
742+
return of_args.args[1] >> 8;
741743
}
742744

743745
static unsigned int aml_count_pins(struct device_node *np)

0 commit comments

Comments
 (0)