msm: acpuclock: Fix error path in multicore targets

Several acpuclock drivers have inherited the same error path bug in
acpuclk_set_rate(). If an invalid cpu is passed as an argument to
these functions, they should return immediately instead of jumping to
the 'out' label, which attempts to unlock a mutex which has never
been acquired.

Change-Id: I47b9709605673a5200caf73a2f2a5086fde63efe
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
This commit is contained in:
Matt Wagantall 2012-07-10 23:20:44 -07:00 committed by Stephen Boyd
parent 2a08aaeb92
commit c1ce50b4cb
3 changed files with 6 additions and 12 deletions

View file

@ -1235,10 +1235,8 @@ static int acpuclk_8960_set_rate(int cpu, unsigned long rate,
unsigned long flags; unsigned long flags;
int rc = 0; int rc = 0;
if (cpu > num_possible_cpus()) { if (cpu > num_possible_cpus())
rc = -EINVAL; return -EINVAL;
goto out;
}
if (reason == SETRATE_CPUFREQ || reason == SETRATE_HOTPLUG) if (reason == SETRATE_CPUFREQ || reason == SETRATE_HOTPLUG)
mutex_lock(&driver_lock); mutex_lock(&driver_lock);

View file

@ -712,10 +712,8 @@ static int acpuclk_8x60_set_rate(int cpu, unsigned long rate,
unsigned long flags; unsigned long flags;
int rc = 0; int rc = 0;
if (cpu > num_possible_cpus()) { if (cpu > num_possible_cpus())
rc = -EINVAL; return -EINVAL;
goto out;
}
if (reason == SETRATE_CPUFREQ || reason == SETRATE_HOTPLUG) if (reason == SETRATE_CPUFREQ || reason == SETRATE_HOTPLUG)
mutex_lock(&drv_state.lock); mutex_lock(&drv_state.lock);

View file

@ -385,10 +385,8 @@ static int acpuclk_krait_set_rate(int cpu, unsigned long rate,
unsigned long flags; unsigned long flags;
int rc = 0; int rc = 0;
if (cpu > num_possible_cpus()) { if (cpu > num_possible_cpus())
rc = -EINVAL; return -EINVAL;
goto out;
}
if (reason == SETRATE_CPUFREQ || reason == SETRATE_HOTPLUG) if (reason == SETRATE_CPUFREQ || reason == SETRATE_HOTPLUG)
mutex_lock(&driver_lock); mutex_lock(&driver_lock);