1 From 6a1bd7cf4ed7a1948f564aaf16d34b7352c0029b Mon Sep 17 00:00:00 2001
2 From: Wan Jiabing <wanjiabing@vivo.com>
3 Date: Tue, 10 May 2022 17:05:31 +0800
4 Subject: [PATCH 12/21] cpufreq: mediatek: Fix potential deadlock problem in
7 Fix following coccichek error:
8 ./drivers/cpufreq/mediatek-cpufreq.c:199:2-8: preceding lock on line
9 ./drivers/cpufreq/mediatek-cpufreq.c:208:2-8: preceding lock on line
11 mutex_lock is acquired but not released before return.
12 Use 'goto out' to help releasing the mutex_lock.
14 Fixes: c210063b40ac ("cpufreq: mediatek: Add opp notification support")
15 Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
16 Reviewed-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
17 Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
19 drivers/cpufreq/mediatek-cpufreq.c | 6 ++++--
20 1 file changed, 4 insertions(+), 2 deletions(-)
22 --- a/drivers/cpufreq/mediatek-cpufreq.c
23 +++ b/drivers/cpufreq/mediatek-cpufreq.c
24 @@ -196,7 +196,8 @@ static int mtk_cpufreq_set_target(struct
27 dev_err(cpu_dev, "invalid Vproc value: %d\n", pre_vproc);
33 freq_hz = freq_table[index].frequency * 1000;
34 @@ -205,7 +206,8 @@ static int mtk_cpufreq_set_target(struct
36 dev_err(cpu_dev, "cpu%d: failed to find OPP for %ld\n",
37 policy->cpu, freq_hz);
38 - return PTR_ERR(opp);
42 vproc = dev_pm_opp_get_voltage(opp);