* [PATCH] cpufreq: mediatek: Fix NULL pointer dereference in mediatek-cpufreq
@ 2022-04-26 11:17 Wan Jiabing
2022-04-26 11:38 ` Matthias Brugger
2022-04-27 3:18 ` Viresh Kumar
0 siblings, 2 replies; 3+ messages in thread
From: Wan Jiabing @ 2022-04-26 11:17 UTC (permalink / raw)
To: Rafael J. Wysocki, Viresh Kumar, Matthias Brugger,
AngeloGioacchino Del Regno, Rex-BC Chen, linux-pm, linux-kernel,
linux-arm-kernel, linux-mediatek
Cc: Wan Jiabing
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>
---
drivers/cpufreq/mediatek-cpufreq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
index bcabb3726a5b..901042e9a240 100644
--- a/drivers/cpufreq/mediatek-cpufreq.c
+++ b/drivers/cpufreq/mediatek-cpufreq.c
@@ -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;
}
--
2.35.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: mediatek: Fix NULL pointer dereference in mediatek-cpufreq
2022-04-26 11:17 [PATCH] cpufreq: mediatek: Fix NULL pointer dereference in mediatek-cpufreq Wan Jiabing
@ 2022-04-26 11:38 ` Matthias Brugger
2022-04-27 3:18 ` Viresh Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Matthias Brugger @ 2022-04-26 11:38 UTC (permalink / raw)
To: Wan Jiabing, Rafael J. Wysocki, Viresh Kumar,
AngeloGioacchino Del Regno, Rex-BC Chen, linux-pm, linux-kernel,
linux-arm-kernel, linux-mediatek
On 26/04/2022 13:17, Wan Jiabing wrote:
> 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>
> ---
> drivers/cpufreq/mediatek-cpufreq.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
> index bcabb3726a5b..901042e9a240 100644
> --- a/drivers/cpufreq/mediatek-cpufreq.c
> +++ b/drivers/cpufreq/mediatek-cpufreq.c
> @@ -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;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: mediatek: Fix NULL pointer dereference in mediatek-cpufreq
2022-04-26 11:17 [PATCH] cpufreq: mediatek: Fix NULL pointer dereference in mediatek-cpufreq Wan Jiabing
2022-04-26 11:38 ` Matthias Brugger
@ 2022-04-27 3:18 ` Viresh Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2022-04-27 3:18 UTC (permalink / raw)
To: Wan Jiabing
Cc: Rafael J. Wysocki, Matthias Brugger, AngeloGioacchino Del Regno,
Rex-BC Chen, linux-pm, linux-kernel, linux-arm-kernel,
linux-mediatek
On 26-04-22, 19:17, Wan Jiabing wrote:
> 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>
> ---
> drivers/cpufreq/mediatek-cpufreq.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
> index bcabb3726a5b..901042e9a240 100644
> --- a/drivers/cpufreq/mediatek-cpufreq.c
> +++ b/drivers/cpufreq/mediatek-cpufreq.c
> @@ -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;
> }
Applied. Thanks.
--
viresh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-27 3:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 11:17 [PATCH] cpufreq: mediatek: Fix NULL pointer dereference in mediatek-cpufreq Wan Jiabing
2022-04-26 11:38 ` Matthias Brugger
2022-04-27 3:18 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®