]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cpufreq: mediatek-hw: Fix wrong return value in mtk_cpufreq_get_cpu_power()
authorJinjie Ruan <ruanjinjie@huawei.com>
Thu, 7 Nov 2024 11:38:41 +0000 (19:38 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:54:17 +0000 (13:54 +0100)
commit2220bb358ef6b6047012153b3b96a4246f974a0d
treee7fe50ef821304ea9ba2eef9b47669a696136283
parent487db736d7c3bdd8726a9b6fe1aa0c5f8c2ba8a4
cpufreq: mediatek-hw: Fix wrong return value in mtk_cpufreq_get_cpu_power()

commit 172bf5ed04cb6c9e66d58de003938ed5c8756570 upstream.

mtk_cpufreq_get_cpu_power() return 0 if the policy is NULL. Then in
em_create_perf_table(), the later zero check for power is not invalid
as power is uninitialized. As Lukasz suggested, it must return -EINVAL when
the 'policy' is not found. So return -EINVAL to fix it.

Cc: stable@vger.kernel.org
Fixes: 4855e26bcf4d ("cpufreq: mediatek-hw: Add support for CPUFREQ HW")
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Suggested-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cpufreq/mediatek-cpufreq-hw.c