diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2019-07-03 11:33:14 +0200 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2019-07-26 09:55:52 +0200 |
commit | 11e1a1648298656722fe206a53e555e2e98668ae (patch) | |
tree | 09baf01360b13b1cc995c8620b0b5c51af52bc5d /drivers/opp/core.c | |
parent | opp: Add dev_pm_opp_find_level_exact() (diff) | |
download | linux-11e1a1648298656722fe206a53e555e2e98668ae.tar.xz linux-11e1a1648298656722fe206a53e555e2e98668ae.zip |
opp: Don't decrement uninitialized list_kref
The list_kref was added for static OPPs and to track their users. The
kref is initialized while the static OPPs are added, but removed
unconditionally even if the static OPPs were never added. This causes
refcount mismatch warnings currently.
Fix that by always initializing the kref when the OPP table is first
initialized. The refcount is later incremented only for the second user
onwards.
Fixes: d0e8ae6c26da ("OPP: Create separate kref for static OPPs list")
Reported-by: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/opp/core.c')
-rw-r--r-- | drivers/opp/core.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 0ee8c0133d3e..9ff0538ee83a 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -988,6 +988,7 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index) BLOCKING_INIT_NOTIFIER_HEAD(&opp_table->head); INIT_LIST_HEAD(&opp_table->opp_list); kref_init(&opp_table->kref); + kref_init(&opp_table->list_kref); /* Secure the device table modification */ list_add(&opp_table->node, &opp_tables); |