]> git.baikalelectronics.ru Git - kernel.git/commit
opp: Don't drop reference for an OPP table that was never parsed
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 31 Aug 2020 07:33:06 +0000 (13:03 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 31 Aug 2020 09:19:47 +0000 (14:49 +0530)
commitbd22114c63473f07965b44c44572a3ca053235c0
treef11160f107302a8d10084606450abfafcc0fd2ed
parente5f0bf958198ed018c9fdf06e8d307ced9af9c95
opp: Don't drop reference for an OPP table that was never parsed

dev_pm_opp_remove_table() should drop a reference to the OPP table only
if the DT OPP table was parsed earlier with a call to
dev_pm_opp_of_add_table() earlier. Else it may end up dropping the
reference to the OPP table, which was added as a result of other calls
like dev_pm_opp_set_clkname(). And would hence result in undesirable
behavior later on when caller would try to free the resource again.

Fixes: f10ea225a0f2 ("opp: Replace list_kref with a local counter")
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Reported-by: Anders Roxell <anders.roxell@linaro.org>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/core.c
drivers/opp/opp.h