From 80007cd1b2aa916e4228d39e332ab5b902f24097 Mon Sep 17 00:00:00 2001 From: Alex Frid Date: Thu, 26 Jan 2012 00:00:07 -0800 Subject: ARM: tegra: cpufreq: Fix error handling in tegra_target() Check error returned by cpufreq table helper API to avoid using uninitialized table index in failed case. Reviewed-on: http://git-master/r/77523 Change-Id: Ie47481a27397c6cafe73bfbddab0a392837ad019 Signed-off-by: Alex Frid Signed-off-by: Varun Wadekar Reviewed-on: http://git-master/r/78439 Reviewed-by: Automatic_Commit_Validation_User --- arch/arm/mach-tegra/cpu-tegra.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'arch/arm/mach-tegra/cpu-tegra.c') diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c index de290ce65804..f182021aa067 100644 --- a/arch/arm/mach-tegra/cpu-tegra.c +++ b/arch/arm/mach-tegra/cpu-tegra.c @@ -7,7 +7,7 @@ * Colin Cross * Based on arch/arm/plat-omap/cpu-omap.c, (C) 2005 Nokia Corporation * - * Copyright (C) 2010-2011 NVIDIA Corporation + * Copyright (C) 2010-2012 NVIDIA Corporation * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -592,14 +592,16 @@ static int tegra_target(struct cpufreq_policy *policy, mutex_lock(&tegra_cpu_lock); - cpufreq_frequency_table_target(policy, freq_table, target_freq, + ret = cpufreq_frequency_table_target(policy, freq_table, target_freq, relation, &idx); + if (ret) + goto _out; freq = freq_table[idx].frequency; target_cpu_speed[policy->cpu] = freq; ret = tegra_cpu_set_speed_cap(&new_speed); - +_out: mutex_unlock(&tegra_cpu_lock); return ret; -- cgit v1.2.3