Skip to content

Commit

Permalink
cpufreq: mediatek: Fix NULL pointer dereference in mediatek-cpufreq
Browse files Browse the repository at this point in the history
Fix following coccicheck error:
drivers/cpufreq/mediatek-cpufreq.c:464:16-23: ERROR: info is NULL but dereferenced.

Use pr_err instead of dev_err to avoid dereferring a NULL pointer.

Fixes: f52b16ba9fe4 ("cpufreq: mediatek: Use device print to show logs")
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
  • Loading branch information
Wan Jiabing authored and Viresh Kumar committed Apr 27, 2022
1 parent ffa7bdf commit a3b8d1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/cpufreq/mediatek-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ static int mtk_cpufreq_init(struct cpufreq_policy *policy)

info = mtk_cpu_dvfs_info_lookup(policy->cpu);
if (!info) {
dev_err(info->cpu_dev,
"dvfs info for cpu%d is not initialized.\n", policy->cpu);
pr_err("dvfs info for cpu%d is not initialized.\n",
policy->cpu);
return -EINVAL;
}

Expand Down

0 comments on commit a3b8d1b

Please sign in to comment.