diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-09-21 09:23:55 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-09-21 09:23:55 +0200 |
| commit | 33f16b25a091687388152d4b29593a39d819aa22 (patch) | |
| tree | 34a8ef8acf3f14ca0e4f514756222876d00ff202 /drivers/opp/core.c | |
| parent | 23f87274f0ad4a9167de23a330ed88966634fdf6 (diff) | |
| parent | ba4f184e126b751d1bffad5897f263108befc780 (diff) | |
Merge 5.9.0-rc6 into tty-next
We need the tty/serial fixes in here and this resolves a merge issue in
the 8250 driver.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/opp/core.c')
| -rw-r--r-- | drivers/opp/core.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 9668ea04cc80..3ca7543142bf 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1296,13 +1296,19 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq) } EXPORT_SYMBOL_GPL(dev_pm_opp_remove); -void _opp_remove_all_static(struct opp_table *opp_table) +bool _opp_remove_all_static(struct opp_table *opp_table) { struct dev_pm_opp *opp, *tmp; + bool ret = true; mutex_lock(&opp_table->lock); - if (!opp_table->parsed_static_opps || --opp_table->parsed_static_opps) + if (!opp_table->parsed_static_opps) { + ret = false; + goto unlock; + } + + if (--opp_table->parsed_static_opps) goto unlock; list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) { @@ -1312,6 +1318,8 @@ void _opp_remove_all_static(struct opp_table *opp_table) unlock: mutex_unlock(&opp_table->lock); + + return ret; } /** @@ -2414,13 +2422,15 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev) return; } - _opp_remove_all_static(opp_table); + /* + * Drop the extra reference only if the OPP table was successfully added + * with dev_pm_opp_of_add_table() earlier. + **/ + if (_opp_remove_all_static(opp_table)) + dev_pm_opp_put_opp_table(opp_table); /* Drop reference taken by _find_opp_table() */ dev_pm_opp_put_opp_table(opp_table); - - /* Drop reference taken while the OPP table was added */ - dev_pm_opp_put_opp_table(opp_table); } /** |
