Re: [PATCH 1/2] cpufreq: use strlen() for governor name comparison
From: Viresh Kumar
Date: Tue Aug 19 2025 - 06:55:35 EST
On 19-08-25, 18:39, Zihuan Zhang wrote:
> Most kernel code using strncasecmp()/strncmp() passes strlen("xxx")
> as the length argument. cpufreq_parse_policy() previously used
> CPUFREQ_NAME_LEN (16), which is longer than the actual strings
> ("performance" is 11 chars, "powersave" is 9 chars).
>
> This patch switches to strlen() for the comparison, making the
> matching slightly more permissive (e.g., "powersavexxx" will now
> also match "powersave"). While this is unlikely to cause functional
> issues, it aligns cpufreq with common kernel style and makes the
> behavior more intuitive.
>
> Signed-off-by: Zihuan Zhang <zhangzihuan@xxxxxxxxxx>
> ---
> drivers/cpufreq/cpufreq.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
--
viresh