mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
cpufreq: qcom-cpufreq-hw: Fix possible NULL pointer dereferences
Add checks to properly handle and fix possible NULL pointer dereferences and avoid usage of uninitialized variables. Change-Id: I30f1b13ee4988286fbd1856f823858dee81fe5a3 Signed-off-by: Jagadeesh Kona <jkona@codeaurora.org>
This commit is contained in:
parent
f532a03ce3
commit
a314e4b894
1 changed files with 8 additions and 2 deletions
|
|
@ -407,6 +407,8 @@ static int qcom_cpufreq_hw_read_lut(struct platform_device *pdev,
|
|||
|
||||
cpu = cpumask_first(&c->related_cpus);
|
||||
|
||||
prev_cc = 0;
|
||||
|
||||
for (i = 0; i < lut_max_entries; i++) {
|
||||
data = readl_relaxed(c->base + offsets[REG_FREQ_LUT] +
|
||||
i * lut_row_size);
|
||||
|
|
@ -440,11 +442,15 @@ static int qcom_cpufreq_hw_read_lut(struct platform_device *pdev,
|
|||
prev_cc = core_count;
|
||||
prev_freq = freq;
|
||||
|
||||
dev_pm_opp_add(get_cpu_device(cpu), freq * 1000, volt);
|
||||
if (get_cpu_device(cpu))
|
||||
dev_pm_opp_add(get_cpu_device(cpu), freq * 1000, volt);
|
||||
}
|
||||
|
||||
c->table[i].frequency = CPUFREQ_TABLE_END;
|
||||
dev_pm_opp_set_sharing_cpus(get_cpu_device(cpu), &c->related_cpus);
|
||||
|
||||
if (get_cpu_device(cpu))
|
||||
dev_pm_opp_set_sharing_cpus(get_cpu_device(cpu),
|
||||
&c->related_cpus);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue