Skip to content

Commit

Permalink
cpufreq: kryo: Fix possible error code dereference
Browse files Browse the repository at this point in the history
In event of error returned by the nvmem_cell_read() non-pointer value
may be dereferenced. Fix this with error handling.
Additionally free the allocated speedbin buffer, as per the API.

Fixes: 9ce36edd1a52 (cpufreq: Add Kryo CPU scaling driver)
Signed-off-by: Ilia Lin <ilia.lin@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Ilia Lin authored and Rafael J. Wysocki committed Jun 19, 2018
1 parent ce397d2 commit ee3dbcf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/cpufreq/qcom-cpufreq-kryo.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev)

speedbin = nvmem_cell_read(speedbin_nvmem, &len);
nvmem_cell_put(speedbin_nvmem);
if (IS_ERR(speedbin))
return PTR_ERR(speedbin);

switch (msm8996_version) {
case MSM8996_V3:
Expand All @@ -127,6 +129,7 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev)
BUG();
break;
}
kfree(speedbin);

for_each_possible_cpu(cpu) {
cpu_dev = get_cpu_device(cpu);
Expand Down

0 comments on commit ee3dbcf

Please sign in to comment.