Skip to content

Commit

Permalink
opp: Call the missing clk_put() on error
Browse files Browse the repository at this point in the history
Fix the clock reference counting by calling the missing clk_put() in the
error path.

Cc: v5.10 <stable@vger.kernel.org> # v5.10
Fixes: dd461cd ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
  • Loading branch information
vireshk committed Dec 28, 2020
1 parent 976509b commit 0e1d9ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/opp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index)
ret = dev_pm_opp_of_find_icc_paths(dev, opp_table);
if (ret) {
if (ret == -EPROBE_DEFER)
goto remove_opp_dev;
goto put_clk;

dev_warn(dev, "%s: Error finding interconnect paths: %d\n",
__func__, ret);
Expand All @@ -1113,6 +1113,9 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index)

return opp_table;

put_clk:
if (!IS_ERR(opp_table->clk))
clk_put(opp_table->clk);
remove_opp_dev:
_remove_opp_dev(opp_dev, opp_table);
err:
Expand Down

0 comments on commit 0e1d9ca

Please sign in to comment.