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

Commit 28761692 authored by gaurav jindal's avatar gaurav jindal
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 2e26e045
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1316,6 +1316,7 @@ static int __init cpufreq_interactive_init(void)
	unsigned int i;
	struct cpufreq_interactive_cpuinfo *pcpu;
	struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
	int ret = 0;

	/* Initalize per-cpu timers */
	for_each_possible_cpu(i) {
@@ -1344,7 +1345,12 @@ static int __init cpufreq_interactive_init(void)
	/* NB: wake up so the thread does not look hung to the freezer */
	wake_up_process(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