Skip to content

Commit 985c788

Browse files
committed
Merge tag 'pm-5.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "These fix a few issues in the operating performance points (OPP) framework. Specifics: - Fix re-enabling of resources in dev_pm_opp_set_rate() (Rajendra Nayak) - Fix OPP table reference counting in error paths (Stephen Boyd)" * tag 'pm-5.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: opp: Enable resources again if they were disabled earlier opp: Put opp table in dev_pm_opp_set_rate() if _set_opp_bw() fails opp: Put opp table in dev_pm_opp_set_rate() for empty tables
2 parents d723b99 + cc15fd9 commit 985c788

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

drivers/opp/core.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,10 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
893893
* have OPP table for the device, while others don't and
894894
* opp_set_rate() just needs to behave like clk_set_rate().
895895
*/
896-
if (!_get_opp_count(opp_table))
897-
return 0;
896+
if (!_get_opp_count(opp_table)) {
897+
ret = 0;
898+
goto put_opp_table;
899+
}
898900

899901
if (!opp_table->required_opp_tables && !opp_table->regulators &&
900902
!opp_table->paths) {
@@ -905,7 +907,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
905907

906908
ret = _set_opp_bw(opp_table, NULL, dev, true);
907909
if (ret)
908-
return ret;
910+
goto put_opp_table;
909911

910912
if (opp_table->regulator_enabled) {
911913
regulator_disable(opp_table->regulators[0]);
@@ -932,10 +934,13 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
932934

933935
/* Return early if nothing to do */
934936
if (old_freq == freq) {
935-
dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n",
936-
__func__, freq);
937-
ret = 0;
938-
goto put_opp_table;
937+
if (!opp_table->required_opp_tables && !opp_table->regulators &&
938+
!opp_table->paths) {
939+
dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n",
940+
__func__, freq);
941+
ret = 0;
942+
goto put_opp_table;
943+
}
939944
}
940945

941946
/*

0 commit comments

Comments
 (0)