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

clk: st: clk-flexgen: Add of_node_put() in st_of_flexgen_setup()

In function st_of_flexgen_setup, variable pnode takes the return value
of of_get_parent, which gets a node but does not put it. If pnode is not
put before the function returns, it may cause a memory leak. Hence put
pnode after its last occurrence.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lkml.kernel.org/r/20190804163151.6511-1-nishkadg.linux@gmail.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Nishka Dasgupta and committed by
Stephen Boyd
d432d045 d55841ce

+1
+1
drivers/clk/st/clk-flexgen.c
··· 326 326 return; 327 327 328 328 reg = of_iomap(pnode, 0); 329 + of_node_put(pnode); 329 330 if (!reg) 330 331 return; 331 332