From 0ac5bfd6d9652d477387764a11e3b48f1afe6891 Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Thu, 7 Jul 2016 11:41:29 +0800 Subject: [PATCH] ARM64: sched: cpufreq_sched: fix bug: init data before use it in thread policy->governor_data will be use in cpufreq_sched_thread, but it is init after wake thread, it will cause NULL point access. Change-Id: I320a3da34560e49f293211be92cb8310d8e395d7 Signed-off-by: Chen Liang --- kernel/sched/cpufreq_sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/cpufreq_sched.c b/kernel/sched/cpufreq_sched.c index c608a9265d6a..48053393dc72 100644 --- a/kernel/sched/cpufreq_sched.c +++ b/kernel/sched/cpufreq_sched.c @@ -265,6 +265,8 @@ static int cpufreq_sched_policy_init(struct cpufreq_policy *policy) pr_debug("%s: throttle threshold = %u [ns]\n", __func__, gd->throttle_nsec); + policy->governor_data = gd; + if (cpufreq_driver_is_slow()) { cpufreq_driver_slow = true; gd->task = kthread_create(cpufreq_sched_thread, policy, @@ -281,7 +283,6 @@ static int cpufreq_sched_policy_init(struct cpufreq_policy *policy) init_irq_work(&gd->irq_work, cpufreq_sched_irq_work); } - policy->governor_data = gd; set_sched_freq(); return 0; -- 2.34.1