aboutsummaryrefslogtreecommitdiff
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorJon Medhurst <tixy@linaro.org>2012-07-20 11:53:56 +0100
committerJon Medhurst <tixy@linaro.org>2013-04-29 09:43:51 +0100
commitea8df6bcc2219a4854d38e33bfb085f532b9c88d (patch)
tree4b9901bef2d88c4a172201e2a6fa186ccda0a6c3 /drivers/cpufreq
parente341ddcc08930576b22eb33525a4c1ef1e9ced36 (diff)
cpufreq: vexpress: Safely handle missing CPU frequencies
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>
Diffstat (limited to 'drivers/cpufreq')
-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);