Skip to content

Commit 1d38eb7

Browse files
joehattorivireshk
authored andcommitted
OPP: OF: Fix an OF node leak in _opp_add_static_v2()
_opp_add_static_v2() leaks the obtained OF node reference when _of_opp_alloc_required_opps() fails. Add an of_node_put() call in the error path. Fixes: 3466ea2 ("OPP: Don't drop opp->np reference while it is still in use") Signed-off-by: Joe Hattori <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent b44b9bc commit 1d38eb7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/opp/of.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
926926

927927
ret = _of_opp_alloc_required_opps(opp_table, new_opp);
928928
if (ret)
929-
goto free_opp;
929+
goto put_node;
930930

931931
if (!of_property_read_u32(np, "clock-latency-ns", &val))
932932
new_opp->clock_latency_ns = val;
@@ -976,6 +976,8 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
976976

977977
free_required_opps:
978978
_of_opp_free_required_opps(opp_table, new_opp);
979+
put_node:
980+
of_node_put(np);
979981
free_opp:
980982
_opp_free(new_opp);
981983

0 commit comments

Comments
 (0)