cpufreq: mediatek-hw: Fix wrong return value in mtk_cpufreq_get_cpu_power()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>

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@xxxxxxxxxxxxxxx
Fixes: 4855e26bcf4d ("cpufreq: mediatek-hw: Add support for CPUFREQ HW")
Reviewed-by: Lukasz Luba <lukasz.luba@xxxxxxx>
Suggested-by: Lukasz Luba <lukasz.luba@xxxxxxx>
Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/cpufreq/mediatek-cpufreq-hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/cpufreq/mediatek-cpufreq-hw.c
+++ b/drivers/cpufreq/mediatek-cpufreq-hw.c
@@ -62,7 +62,7 @@ mtk_cpufreq_get_cpu_power(struct device
 
 	policy = cpufreq_cpu_get_raw(cpu_dev->id);
 	if (!policy)
-		return 0;
+		return -EINVAL;
 
 	data = policy->driver_data;
 


Patches currently in stable-queue which might be from ruanjinjie@xxxxxxxxxx are

queue-6.12/drm-imx-ipuv3-use-irqf_no_autoen-flag-in-request_irq.patch
queue-6.12/cpufreq-cppc-fix-possible-null-ptr-deref-for-cpufreq.patch
queue-6.12/apparmor-test-fix-memory-leak-for-aa_unpack_strdup.patch
queue-6.12/mfd-tps65010-use-irqf_no_autoen-flag-in-request_irq-.patch
queue-6.12/cpufreq-cppc-fix-possible-null-ptr-deref-for-cppc_ge.patch
queue-6.12/spi-spi-fsl-lpspi-use-irqf_no_autoen-flag-in-request.patch
queue-6.12/cpufreq-cppc-fix-wrong-return-value-in-cppc_get_cpu_.patch
queue-6.12/cpufreq-mediatek-hw-fix-wrong-return-value-in-mtk_cpufreq_get_cpu_power.patch
queue-6.12/wifi-mwifiex-use-irqf_no_autoen-flag-in-request_irq.patch
queue-6.12/drm-imx-dcss-use-irqf_no_autoen-flag-in-request_irq.patch
queue-6.12/drm-msm-adreno-use-irqf_no_autoen-flag-in-request_ir.patch
queue-6.12/cpufreq-cppc-fix-wrong-return-value-in-cppc_get_cpu_.patch-26269
queue-6.12/misc-apds990x-fix-missing-pm_runtime_disable.patch
queue-6.12/wifi-p54-use-irqf_no_autoen-flag-in-request_irq.patch
queue-6.12/spi-zynqmp-gqspi-undo-runtime-pm-changes-at-driver-e.patch
queue-6.12/soc-ti-smartreflex-use-irqf_no_autoen-flag-in-reques.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux