f2f572a753faec9f4934b923c33f5009215f0235
[openwrt/staging/wigyori.git] /
1 From fa7030d8ad4638acfd9e0fac84a20716d031dc95 Mon Sep 17 00:00:00 2001
2 From: Wan Jiabing <wanjiabing@vivo.com>
3 Date: Tue, 26 Apr 2022 19:17:14 +0800
4 Subject: [PATCH 08/21] cpufreq: mediatek: Fix NULL pointer dereference in
5 mediatek-cpufreq
6
7 Fix following coccicheck error:
8 drivers/cpufreq/mediatek-cpufreq.c:464:16-23: ERROR: info is NULL but dereferenced.
9
10 Use pr_err instead of dev_err to avoid dereferring a NULL pointer.
11
12 Fixes: f52b16ba9fe4 ("cpufreq: mediatek: Use device print to show logs")
13 Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
14 Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
15 Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
16 ---
17 drivers/cpufreq/mediatek-cpufreq.c | 4 ++--
18 1 file changed, 2 insertions(+), 2 deletions(-)
19
20 --- a/drivers/cpufreq/mediatek-cpufreq.c
21 +++ b/drivers/cpufreq/mediatek-cpufreq.c
22 @@ -463,8 +463,8 @@ static int mtk_cpufreq_init(struct cpufr
23
24 info = mtk_cpu_dvfs_info_lookup(policy->cpu);
25 if (!info) {
26 - dev_err(info->cpu_dev,
27 - "dvfs info for cpu%d is not initialized.\n", policy->cpu);
28 + pr_err("dvfs info for cpu%d is not initialized.\n",
29 + policy->cpu);
30 return -EINVAL;
31 }
32