Message ID | 3a82b2d3311e16f0f638de18bf0ee803540014a3.1507096875.git.viresh.kumar@linaro.org (mailing list archive) |
---|---|
State | Mainlined |
Delegated to: | Rafael Wysocki |
Headers | show |
On 10/03/2017 11:05 PM, Viresh Kumar wrote: > From: Tobias Jordan <Tobias.Jordan@elektrobit.com> > > The for_each_available_child_of_node() loop in _of_add_opp_table_v2() > doesn't drop the reference to "np" on errors. Fix that. > > Fixes: 274659029c9d ("PM / OPP: Add support to parse "operating-points-v2" bindings") > Cc: 4.3+ <stable@vger.kernel.org> # 4.3+ > Signed-off-by: Tobias Jordan <Tobias.Jordan@elektrobit.com> > [ VK: Improved commit log. ] > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Looks like that opp_table->np = opp_np assignment in this function needs to do an of_node_get() because the caller of this function puts the pointer unconditionally.
On 04-10-17, 09:42, Stephen Boyd wrote: > On 10/03/2017 11:05 PM, Viresh Kumar wrote: > > From: Tobias Jordan <Tobias.Jordan@elektrobit.com> > > > > The for_each_available_child_of_node() loop in _of_add_opp_table_v2() > > doesn't drop the reference to "np" on errors. Fix that. > > > > Fixes: 274659029c9d ("PM / OPP: Add support to parse "operating-points-v2" bindings") > > Cc: 4.3+ <stable@vger.kernel.org> # 4.3+ > > Signed-off-by: Tobias Jordan <Tobias.Jordan@elektrobit.com> > > [ VK: Improved commit log. ] > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > > --- > > Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> > > Looks like that opp_table->np = opp_np assignment in this function needs > to do an of_node_get() because the caller of this function puts the > pointer unconditionally. We only use that pointer (opp_table->np) in _managed_opp() to compare the address. Perhaps we don't need to do a of_node_get() there.
diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 0b718886479b..87509cb69f79 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -397,6 +397,7 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) dev_err(dev, "%s: Failed to add OPP, %d\n", __func__, ret); _dev_pm_opp_remove_table(opp_table, dev, false); + of_node_put(np); goto put_opp_table; } }