cpufreq: Warn users while freeing active policy
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 7 Jul 2022 09:58:31 +0000 (15:28 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 15 Jul 2022 17:19:51 +0000 (19:19 +0200)
commita2f6a7ac60e234810a386aaa6aad106927c39c4f
tree1d6d450f33694fa6ec0fca2a4f0e5df13aaf1574
parentca62229162a905b13f02e081767bf126f230ecc9
cpufreq: Warn users while freeing active policy

With the new design in place, the show() and store() callbacks check if
the policy is active or not before proceeding any further to avoid
potential races. And in order to guarantee that cpufreq_policy_free()
must be called after clearing the policy->cpus mask, i.e. by marking the
policy inactive.

In order to avoid introducing a bug around this later, print a warning
message if we end up freeing an active policy.

Also update cpufreq_online() a bit to make sure we clear the cpus mask
for each error case before calling cpufreq_policy_free().

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c