Skip to content

Commit 977a3b0

Browse files
committed
Merge branch 'opp/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm
Pull operating performance points (OPP) framework fixes for 5.11-rc2 from Viresh Kumar: "This contains two patches to fix freeing of resources in error paths." * 'opp/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm: opp: Call the missing clk_put() on error opp: fix memory leak in _allocate_opp_table
2 parents 5c8fe58 + 0e1d9ca commit 977a3b0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/opp/core.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index)
10921092
if (IS_ERR(opp_table->clk)) {
10931093
ret = PTR_ERR(opp_table->clk);
10941094
if (ret == -EPROBE_DEFER)
1095-
goto err;
1095+
goto remove_opp_dev;
10961096

10971097
dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__, ret);
10981098
}
@@ -1101,7 +1101,7 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index)
11011101
ret = dev_pm_opp_of_find_icc_paths(dev, opp_table);
11021102
if (ret) {
11031103
if (ret == -EPROBE_DEFER)
1104-
goto err;
1104+
goto put_clk;
11051105

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

11141114
return opp_table;
11151115

1116+
put_clk:
1117+
if (!IS_ERR(opp_table->clk))
1118+
clk_put(opp_table->clk);
1119+
remove_opp_dev:
1120+
_remove_opp_dev(opp_dev, opp_table);
11161121
err:
11171122
kfree(opp_table);
11181123
return ERR_PTR(ret);

0 commit comments

Comments
 (0)