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

Commit 35a2dab6 authored by Junjie Wu's avatar Junjie Wu
Browse files

cpufreq: Return directly in __cpufreq_get if policy is NULL



__cpufreq_get() checks whether policy->cur matches frequency returned
by cpufreq device driver and acts accordingly. However, policy could
be NULL if the CPU is being hotplugged. Current implementation crashes
when trying to dereference the NULL policy.

Return the frequency provided by cpufreq device driver directly if
policy is not available.

Change-Id: I1f2ba4028c259392bf730db37dbec2d8c5ae3fa4
Signed-off-by: default avatarJunjie Wu <junjiew@codeaurora.org>
parent 59973f39
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1463,6 +1463,9 @@ static unsigned int __cpufreq_get(unsigned int cpu)

	ret_freq = cpufreq_driver->get(cpu);

	if (!policy)
		return ret_freq;

	if (ret_freq && policy->cur &&
		!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
		/* verify no discrepancy between actual and