From c27180b4c7bbfb0ba030d22e831f3bf13ced70bc Mon Sep 17 00:00:00 2001 From: Vivek Aknurwar Date: Tue, 1 Feb 2022 11:14:55 -0800 Subject: [PATCH] cpufreq: qcom-hw: Initialize qcom_cpufreq_counter spinlock Initialize qcom_cpufreq_counter spinlock to avoid uninitilized access or panic when driver tries to get lock during cycle_counter framework call. Change-Id: If56cf3030a2d468c0493a5946c778908fd015221 Signed-off-by: Vivek Aknurwar --- drivers/cpufreq/qcom-cpufreq-hw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 93035db9a5e7..6830b35868b8 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -705,7 +705,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) { struct device *cpu_dev; struct clk *clk; - int ret; + int ret, cpu; clk = clk_get(&pdev->dev, "xo"); if (IS_ERR(clk)) @@ -732,6 +732,9 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) if (ret) return ret; + for_each_possible_cpu(cpu) + spin_lock_init(&qcom_cpufreq_counter[cpu].lock); + ret = cpufreq_register_driver(&cpufreq_qcom_hw_driver); if (ret) dev_err(&pdev->dev, "CPUFreq HW driver failed to register\n");