Re: [PATCH v3 1/3] cpufreq: add cpufreq_driver_resolve_freq()

From: Viresh Kumar
Date: Thu Jul 21 2016 - 17:13:50 EST


On 13-07-16, 13:25, Steve Muckle wrote:
> +unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
> + unsigned int target_freq)
> +{
> + target_freq = clamp_val(target_freq, policy->min, policy->max);
> + policy->cached_target_freq = target_freq;
> + if (cpufreq_driver->resolve_freq)
> + return cpufreq_driver->resolve_freq(policy, target_freq);
> + policy->cached_resolved_idx =
> + cpufreq_frequency_table_target(policy, target_freq,
> + CPUFREQ_RELATION_L);
> + return policy->freq_table[policy->cached_resolved_idx].frequency;

FWIW, this may crash the kernel for a driver that provides ->target()
but no ->resolve_freq().

--
viresh