Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 6e9be3abb78c ("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>

authored by

Felix Gu and committed by
Linus Walleij
e56aa18e eabf273c

+6 -4
+6 -4
drivers/pinctrl/meson/pinctrl-amlogic-a4.c
··· 725 725 if (of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 726 726 0, &of_args)) 727 727 return 0; 728 - else 729 - return of_args.args[2]; 728 + 729 + of_node_put(of_args.np); 730 + return of_args.args[2]; 730 731 } 731 732 732 733 static int aml_bank_number(struct device_node *np) ··· 737 736 if (of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 738 737 0, &of_args)) 739 738 return -EINVAL; 740 - else 741 - return of_args.args[1] >> 8; 739 + 740 + of_node_put(of_args.np); 741 + return of_args.args[1] >> 8; 742 742 } 743 743 744 744 static unsigned int aml_count_pins(struct device_node *np)