cpufreq: Abort show()/store() for half-initialized policies
authorSchspa Shi <schspa@gmail.com>
Mon, 16 May 2022 03:02:50 +0000 (11:02 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 17 May 2022 19:39:04 +0000 (21:39 +0200)
commitd4627a287e251efed59f2b4bda82c5950768c963
tree146bae98dcd7549b946885647acdbf4a1385cf56
parentf339f3541701d824a0256ad4bf14c26ceb6d79c3
cpufreq: Abort show()/store() for half-initialized policies

If policy initialization fails after the sysfs files are created,
there is a possibility to end up running show()/store() callbacks
for half-initialized policies, which may have unpredictable
outcomes.

Abort show()/store() in such a case by making sure the policy is active.

Also dectivate the policy on such failures.

Signed-off-by: Schspa Shi <schspa@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c