Skip to content

Commit

Permalink
ARM: imx51: fix a leaked reference by adding missing of_node_put
Browse files Browse the repository at this point in the history
The call to of_get_next_child returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
./arch/arm/mach-imx/mach-imx51.c:64:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 57, but without a corresponding object release within this function.

Signed-off-by: Wen Yang <[email protected]>
Cc: Russell King <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Shawn Guo <[email protected]>
  • Loading branch information
taskset authored and Shawn Guo committed Mar 19, 2019
1 parent 1a7ee0e commit 0c17e83
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions arch/arm/mach-imx/mach-imx51.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ static void __init imx51_m4if_setup(void)
return;

m4if_base = of_iomap(np, 0);
of_node_put(np);
if (!m4if_base) {
pr_err("Unable to map M4IF registers\n");
return;
Expand Down

0 comments on commit 0c17e83

Please sign in to comment.