summaryrefslogtreecommitdiff
path: root/drivers/cpufreq/s5pv210-cpufreq.c
diff options
context:
space:
mode:
authorchenqiwu <chenqiwu@xiaomi.com>2020-01-07 10:53:19 +0300
committerViresh Kumar <viresh.kumar@linaro.org>2020-01-07 11:01:01 +0300
commit8ead819f1befae08182c772b6fdf8ac201b34566 (patch)
tree0e72eab18e10d35791a36966e8152faaf6149394 /drivers/cpufreq/s5pv210-cpufreq.c
parent83fe39ad0a489200d731c78bfdd40e199e5a9cd2 (diff)
downloadlinux-8ead819f1befae08182c772b6fdf8ac201b34566.tar.xz
cpufreq: s3c: fix unbalances of cpufreq policy refcount
The cpufreq_reboot_notifier_evt() call cpufreq_cpu_get() to get the cpufreq policy of cpu0, meanwhile, it also increments the kobject reference count to mark it busy. However, a corresponding call of cpufreq_cpu_put() is ignored to decrement the kobject reference count back, which may lead to a potential stuck risk that the cpuhp thread deadly waits for dropping of kobject refcount when cpufreq policy free. With this patch, the cpuhp thread can be easily exercised by attempting to force an unbind of the CPUfreq driver. Signed-off-by: chenqiwu <chenqiwu@xiaomi.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/cpufreq/s5pv210-cpufreq.c')
-rw-r--r--drivers/cpufreq/s5pv210-cpufreq.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
index 5d10030f2560..e84281e2561d 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -555,8 +555,17 @@ static int s5pv210_cpufreq_reboot_notifier_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
int ret;
+ struct cpufreq_policy *policy;
+
+ policy = cpufreq_cpu_get(0);
+ if (!policy) {
+ pr_debug("cpufreq: get no policy for cpu0\n");
+ return NOTIFY_BAD;
+ }
+
+ ret = cpufreq_driver_target(policy, SLEEP_FREQ, 0);
+ cpufreq_cpu_put(policy);
- ret = cpufreq_driver_target(cpufreq_cpu_get(0), SLEEP_FREQ, 0);
if (ret < 0)
return NOTIFY_BAD;