mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 04:12:04 -04:00
cpufreq: qcom: cpufreq-hw: Add check for get_cpu_device before usage
Check if the get_cpu_device is NULL before using it for the OPP usage. Change-Id: I312da0199eac7a78a84f0584e505ab800904f77f Signed-off-by: Taniya Das <tdas@codeaurora.org>
This commit is contained in:
parent
5fe63e27d1
commit
8ede36cd8b
1 changed files with 6 additions and 6 deletions
|
|
@ -396,7 +396,7 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = {
|
|||
static int qcom_cpufreq_hw_read_lut(struct platform_device *pdev,
|
||||
struct cpufreq_qcom *c, u32 max_cores)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device *dev = &pdev->dev, *cpu_dev;
|
||||
u32 data, src, lval, i, core_count, prev_cc, prev_freq, freq, volt;
|
||||
unsigned long cpu;
|
||||
|
||||
|
|
@ -406,6 +406,7 @@ static int qcom_cpufreq_hw_read_lut(struct platform_device *pdev,
|
|||
return -ENOMEM;
|
||||
|
||||
cpu = cpumask_first(&c->related_cpus);
|
||||
cpu_dev = get_cpu_device(cpu);
|
||||
|
||||
prev_cc = 0;
|
||||
|
||||
|
|
@ -442,15 +443,14 @@ static int qcom_cpufreq_hw_read_lut(struct platform_device *pdev,
|
|||
prev_cc = core_count;
|
||||
prev_freq = freq;
|
||||
|
||||
if (get_cpu_device(cpu))
|
||||
dev_pm_opp_add(get_cpu_device(cpu), freq * 1000, volt);
|
||||
if (cpu_dev)
|
||||
dev_pm_opp_add(cpu_dev, freq * 1000, volt);
|
||||
}
|
||||
|
||||
c->table[i].frequency = CPUFREQ_TABLE_END;
|
||||
|
||||
if (get_cpu_device(cpu))
|
||||
dev_pm_opp_set_sharing_cpus(get_cpu_device(cpu),
|
||||
&c->related_cpus);
|
||||
if (cpu_dev)
|
||||
dev_pm_opp_set_sharing_cpus(cpu_dev, &c->related_cpus);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue