Commit 49ed86f5 authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Kevin Hilman

soc: amlogic: meson-gx-socinfo: Add of_node_put() before return

The variable np in function meson_gx_socinfo_init takes the return value
of of_find_compatible_node, which gets a node but does not put it. If
this node is not put it may cause a memory leak. Hence put np after its
usefulness has been exhausted.
Issue found with Coccinelle.
Signed-off-by: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Reviewed-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Fixes: a9daaba2 ("soc: Add Amlogic SoC Information driver")
Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
parent 62369971
......@@ -141,8 +141,10 @@ static int __init meson_gx_socinfo_init(void)
}
/* check if chip-id is available */
if (!of_property_read_bool(np, "amlogic,has-chip-id"))
if (!of_property_read_bool(np, "amlogic,has-chip-id")) {
of_node_put(np);
return -ENODEV;
}
/* node should be a syscon */
regmap = syscon_node_to_regmap(np);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment