[PATCH] cpufreq: schedutil: Prevent unnecessary mutex unlock

From: Jules Maselbas
Date: Thu Mar 29 2018 - 10:43:44 EST


This patch prevents the mutex global_tunables_lock from being
unlocked before being locked. This mutex is not locked if the
function sugov_kthread_create fails.

Signed-off-by: Jules Maselbas <jules.maselbas@xxxxxxx>
---
kernel/sched/cpufreq_schedutil.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 7936f548e071..617c6741c525 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -625,10 +625,9 @@ static int sugov_init(struct cpufreq_policy *policy)

stop_kthread:
sugov_kthread_stop(sg_policy);
-
-free_sg_policy:
mutex_unlock(&global_tunables_lock);

+free_sg_policy:
sugov_policy_free(sg_policy);

disable_fast_switch:
--
2.16.2