mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 13:37:36 +02:00
cpufreq: Make cpufreq_online() call driver->offline() on errors
[ Upstream commit3b7180573c] In the CPU removal path the ->offline() callback provided by the driver is always invoked before ->exit(), but in the cpufreq_online() error path it is not, so ->exit() is expected to somehow know the context in which it has been called and act accordingly. That is less than straightforward, so make cpufreq_online() invoke the driver's ->offline() callback, if present, on errors before ->exit() too. This only potentially affects intel_pstate. Fixes:91a12e91dc("cpufreq: Allow light-weight tear down and bring up of CPUs") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
cc0b1776fd
commit
3e33b1329c
|
|
@ -1368,9 +1368,14 @@ static int cpufreq_online(unsigned int cpu)
|
||||||
goto out_free_policy;
|
goto out_free_policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The initialization has succeeded and the policy is online.
|
||||||
|
* If there is a problem with its frequency table, take it
|
||||||
|
* offline and drop it.
|
||||||
|
*/
|
||||||
ret = cpufreq_table_validate_and_sort(policy);
|
ret = cpufreq_table_validate_and_sort(policy);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_exit_policy;
|
goto out_offline_policy;
|
||||||
|
|
||||||
/* related_cpus should at least include policy->cpus. */
|
/* related_cpus should at least include policy->cpus. */
|
||||||
cpumask_copy(policy->related_cpus, policy->cpus);
|
cpumask_copy(policy->related_cpus, policy->cpus);
|
||||||
|
|
@ -1513,6 +1518,10 @@ static int cpufreq_online(unsigned int cpu)
|
||||||
|
|
||||||
up_write(&policy->rwsem);
|
up_write(&policy->rwsem);
|
||||||
|
|
||||||
|
out_offline_policy:
|
||||||
|
if (cpufreq_driver->offline)
|
||||||
|
cpufreq_driver->offline(policy);
|
||||||
|
|
||||||
out_exit_policy:
|
out_exit_policy:
|
||||||
if (cpufreq_driver->exit)
|
if (cpufreq_driver->exit)
|
||||||
cpufreq_driver->exit(policy);
|
cpufreq_driver->exit(policy);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user