From: Vencent Liu <secur...@tencent.com> In the ls_uarts_init function, the device node reference count wasn't properly released on error paths. When `of_get_property("clock-frequency")` fails, the function returns `-EINVAL` without calling `of_node_put(avr)` to release the device node reference obtained by `of_find_node_by_path()`.
Signed-off-by: Vencent Liu <secur...@tencent.com> --- arch/powerpc/platforms/embedded6xx/ls_uart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c b/arch/powerpc/platforms/embedded6xx/ls_uart.c index 6c1dbf8ae718..b889206bea4c 100644 --- a/arch/powerpc/platforms/embedded6xx/ls_uart.c +++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c @@ -18,6 +18,7 @@ #include <linux/of_address.h> #include <asm/io.h> #include <asm/termbits.h> +#include <linux/cleanup.h> #include "mpc10x.h" @@ -114,11 +115,11 @@ static void __init ls_uart_init(void) static int __init ls_uarts_init(void) { - struct device_node *avr; struct resource res; int len, ret; - avr = of_find_node_by_path("/soc10x/serial@80004500"); + struct device_node *avr __free(device_node) = + of_find_node_by_path("/soc10x/serial@80004500"); if (!avr) return -EINVAL; -- 2.43.5