Commit e56aa18e authored by Felix Gu's avatar Felix Gu Committed by Linus Walleij
Browse files

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: 6e9be3ab ("pinctrl: Add driver support for Amlogic SoCs")
Signed-off-by: default avatarFelix Gu <ustc.gu@gmail.com>
Reviewed-by: default avatarXianwei Zhao <xianwei.zhao@amlogic.com>
Signed-off-by: default avatarLinus Walleij <linusw@kernel.org>
parent eabf273c
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -725,7 +725,8 @@ static u32 aml_bank_pins(struct device_node *np)
	if (of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3,
					     0, &of_args))
		return 0;
	else

	of_node_put(of_args.np);
	return of_args.args[2];
}

@@ -736,7 +737,8 @@ static int aml_bank_number(struct device_node *np)
	if (of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3,
					     0, &of_args))
		return -EINVAL;
	else

	of_node_put(of_args.np);
	return of_args.args[1] >> 8;
}