summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Medhurst <tixy@linaro.org>2012-07-20 11:53:56 +0100
committerJon Medhurst <tixy@linaro.org>2012-07-23 13:35:07 +0100
commite8ff46dd7e0f7a787af16ca39d0594c3be2f8859 (patch)
tree099dc00a3c0a1cedf8183f2876b34a747de970bd
parent179e31911956f5287135ed1187980fe197911567 (diff)
downloadvexpress-a9-armlt-linaro-android-3.5-alt.tar.gz
cpufreq: vexpress: Safely handle missing CPU frequenciesarmlt-linaro-android-3.5-alt-20120720armlt-linaro-android-3.5-alt
If there are no CPU frequencies in the device tree for the current cluster, then vexpress_cpufreq_of_init() passes a null pointer to cpufreq_frequency_table_cpuinfo(), which it then dereferences. This patch tests for this situation and cleanly returns and error instead. Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r--drivers/cpufreq/vexpress_bL_cpufreq.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/cpufreq/vexpress_bL_cpufreq.c b/drivers/cpufreq/vexpress_bL_cpufreq.c
index 88ac95ef85c..1fffaef366a 100644
--- a/drivers/cpufreq/vexpress_bL_cpufreq.c
+++ b/drivers/cpufreq/vexpress_bL_cpufreq.c
@@ -214,6 +214,9 @@ static int vexpress_cpufreq_init(struct cpufreq_policy *policy)
if (atomic_inc_return(&freq_table_users) == 1)
result = vexpress_cpufreq_of_init();
+ if (freq_table[cur_cluster] == NULL)
+ result = -ENODATA;
+
if (result) {
atomic_dec_return(&freq_table_users);
pr_err("CPUFreq - CPU %d failed to initialize\n", policy->cpu);