cpuquiet: balanced governor requires cpufreq
authorPeter De Schrijver <pdeschrijver@nvidia.com>
Tue, 11 Sep 2012 14:27:51 +0000 (17:27 +0300)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 18 May 2015 08:07:08 +0000 (16:07 +0800)
The balanced governor relies on cpufreq for some of its decisions. Fail
initialization if there are no cpufreq OPP tables available.

Change-Id: I5d64215d56f50d5df52c1433208b1eb40440c812
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-on: http://git-master/r/131437
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Rebase-Id: R03bb471218a088a816a67232861759cba2b91f38

drivers/cpuquiet/governors/balanced.c

index 86a012a5ace53b8fc53505a183146d01598da72b..f187206ef1c46b434d416198c3db53a8d3e4d3af 100644 (file)
@@ -511,8 +511,14 @@ static int balanced_start(void)
        down_delay = msecs_to_jiffies(2000);
 
        table = cpufreq_frequency_get_table(0);
+       if (!table)
+               return -EINVAL;
+
        for (count = 0; table[count].frequency != CPUFREQ_TABLE_END; count++);
 
+       if (count < 4)
+               return -EINVAL;
+
        idle_top_freq = table[(count / 2) - 1].frequency;
        idle_bottom_freq = table[(count / 2) - 2].frequency;