Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c210720 authored by gaurav jindal's avatar gaurav jindal Committed by Razziell
Browse files

drivers: cpufreq_interactive: handle error for module load fail



If the cpufreq_register_governor fails, resources for thread
speedchange_task should be released.
currently, concerned  resources are released in module_exit,
but if module loading fails, exit will not be called
and resources will remain acquired. this may leave kernel
in an unstable state.

Change-Id: Ic33f058c069d30bfd114fa1c1380325c8e00b51c
Signed-off-by: default avatargaurav jindal <gauravjindal1104@gmail.com>
parent 9e563e9c
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1831,6 +1831,7 @@ struct cpufreq_governor cpufreq_gov_interactive = {
static int __init cpufreq_interactive_init(void)
{
	struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
	int ret = 0;

	spin_lock_init(&speedchange_cpumask_lock);
	mutex_init(&gov_lock);
@@ -1847,7 +1848,12 @@ static int __init cpufreq_interactive_init(void)
	/* NB: wake up so the thread does not look hung to the freezer */
	wake_up_process_no_notif(speedchange_task);

	return cpufreq_register_governor(&cpufreq_gov_interactive);
	ret = cpufreq_register_governor(&cpufreq_gov_interactive);
	if (ret) {
		kthread_stop(speedchange_task);
		put_task_struct(speedchange_task);
	}
	return ret;
}

#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE