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

clk: ti: dm814x: Add of_node_put() to prevent memory leak

In function dm814x_adpll_early_init, variable np takes the value
returned by of_find_node_by_name, which gets a node but does not put it.
If np is not put before return, it may cause a memory leak. Hence put np
before return.
Issue found with Coccinelle.

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

authored by

Nishka Dasgupta and committed by
Stephen Boyd
b684702f d432d045

+1
+1
drivers/clk/ti/clk-814x.c
··· 66 66 } 67 67 68 68 of_platform_populate(np, NULL, NULL, NULL); 69 + of_node_put(np); 69 70 70 71 return 0; 71 72 }