mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-12 20:35:23 +02:00
cpufreq: exit() callback is optional
[ Upstream commitb8f85833c0
] The exit() callback is optional and shouldn't be called without checking a valid pointer first. Also, we must clear freq_table pointer even if the exit() callback isn't present. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Fixes:91a12e91dc
("cpufreq: Allow light-weight tear down and bring up of CPUs") Fixes:f339f35417
("cpufreq: Rearrange locking in cpufreq_remove_dev()") Reported-by: Lizhe <sensor1010@163.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
99f3af0a1a
commit
3e99f060cf
|
@ -1670,10 +1670,13 @@ static void __cpufreq_offline(unsigned int cpu, struct cpufreq_policy *policy)
|
||||||
*/
|
*/
|
||||||
if (cpufreq_driver->offline) {
|
if (cpufreq_driver->offline) {
|
||||||
cpufreq_driver->offline(policy);
|
cpufreq_driver->offline(policy);
|
||||||
} else if (cpufreq_driver->exit) {
|
return;
|
||||||
cpufreq_driver->exit(policy);
|
|
||||||
policy->freq_table = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cpufreq_driver->exit)
|
||||||
|
cpufreq_driver->exit(policy);
|
||||||
|
|
||||||
|
policy->freq_table = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cpufreq_offline(unsigned int cpu)
|
static int cpufreq_offline(unsigned int cpu)
|
||||||
|
@ -1731,7 +1734,7 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We did light-weight exit earlier, do full tear down now */
|
/* We did light-weight exit earlier, do full tear down now */
|
||||||
if (cpufreq_driver->offline)
|
if (cpufreq_driver->offline && cpufreq_driver->exit)
|
||||||
cpufreq_driver->exit(policy);
|
cpufreq_driver->exit(policy);
|
||||||
|
|
||||||
up_write(&policy->rwsem);
|
up_write(&policy->rwsem);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user