1
0
Fork 0

MLK-20203-2 cpufreq: imx7ulp: fix coverity issue

This patch fixes coverity issue of "divide by 0".

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
pull/10/head
Anson Huang 2018-11-03 12:16:08 +08:00
parent 90c0f2b1ba
commit eb2d777665
1 changed files with 2 additions and 0 deletions

View File

@ -47,6 +47,8 @@ static int imx7ulp_set_target(struct cpufreq_policy *policy, unsigned int index)
new_freq = freq_table[index].frequency;
freq_hz = new_freq * 1000;
old_freq = clk_get_rate(arm_clk) / 1000;
if (new_freq == 0 || old_freq == 0)
return -EINVAL;
opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_hz);
if (IS_ERR(opp)) {