* [PATCH] cpufreq: apple-soc: Fix an IS_ERR() vs NULL check
@ 2023-02-27 10:07 Dan Carpenter
2023-02-27 10:26 ` Eric Curtin
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2023-02-27 10:07 UTC (permalink / raw)
To: Hector Martin
Cc: Sven Peter, Alyssa Rosenzweig, Rafael J. Wysocki, Viresh Kumar,
Marc Zyngier, asahi, linux-pm, kernel-janitors
The of_iomap() function returns NULL if it fails. It never returns
error pointers. Fix the check accordingly.
Fixes: 6286bbb40576 ("cpufreq: apple-soc: Add new driver to control Apple SoC CPU P-states")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
drivers/cpufreq/apple-soc-cpufreq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c
index c11d22fd84c3..021f423705e1 100644
--- a/drivers/cpufreq/apple-soc-cpufreq.c
+++ b/drivers/cpufreq/apple-soc-cpufreq.c
@@ -189,8 +189,8 @@ static int apple_soc_cpufreq_find_cluster(struct cpufreq_policy *policy,
*info = match->data;
*reg_base = of_iomap(args.np, 0);
- if (IS_ERR(*reg_base))
- return PTR_ERR(*reg_base);
+ if (!*reg_base)
+ return -ENOMEM;
return 0;
}
--
2.39.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] cpufreq: apple-soc: Fix an IS_ERR() vs NULL check
2023-02-27 10:07 [PATCH] cpufreq: apple-soc: Fix an IS_ERR() vs NULL check Dan Carpenter
@ 2023-02-27 10:26 ` Eric Curtin
2023-03-01 18:36 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Eric Curtin @ 2023-02-27 10:26 UTC (permalink / raw)
To: Dan Carpenter
Cc: Hector Martin, Sven Peter, Alyssa Rosenzweig, Rafael J. Wysocki,
Viresh Kumar, Marc Zyngier, asahi, linux-pm, kernel-janitors
On Mon, 27 Feb 2023 at 10:16, Dan Carpenter <error27@gmail.com> wrote:
>
> The of_iomap() function returns NULL if it fails. It never returns
> error pointers. Fix the check accordingly.
>
> Fixes: 6286bbb40576 ("cpufreq: apple-soc: Add new driver to control Apple SoC CPU P-states")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
Nice catch!
Reviewed-by: Eric Curtin <ecurtin@redhat.com>
Is mise le meas/Regards,
Eric Curtin
> drivers/cpufreq/apple-soc-cpufreq.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c
> index c11d22fd84c3..021f423705e1 100644
> --- a/drivers/cpufreq/apple-soc-cpufreq.c
> +++ b/drivers/cpufreq/apple-soc-cpufreq.c
> @@ -189,8 +189,8 @@ static int apple_soc_cpufreq_find_cluster(struct cpufreq_policy *policy,
> *info = match->data;
>
> *reg_base = of_iomap(args.np, 0);
> - if (IS_ERR(*reg_base))
> - return PTR_ERR(*reg_base);
> + if (!*reg_base)
> + return -ENOMEM;
>
> return 0;
> }
> --
> 2.39.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] cpufreq: apple-soc: Fix an IS_ERR() vs NULL check
2023-02-27 10:26 ` Eric Curtin
@ 2023-03-01 18:36 ` Rafael J. Wysocki
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2023-03-01 18:36 UTC (permalink / raw)
To: Eric Curtin, Dan Carpenter
Cc: Hector Martin, Sven Peter, Alyssa Rosenzweig, Rafael J. Wysocki,
Viresh Kumar, Marc Zyngier, asahi, linux-pm, kernel-janitors
On Mon, Feb 27, 2023 at 11:26 AM Eric Curtin <ecurtin@redhat.com> wrote:
>
> On Mon, 27 Feb 2023 at 10:16, Dan Carpenter <error27@gmail.com> wrote:
> >
> > The of_iomap() function returns NULL if it fails. It never returns
> > error pointers. Fix the check accordingly.
> >
> > Fixes: 6286bbb40576 ("cpufreq: apple-soc: Add new driver to control Apple SoC CPU P-states")
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> > ---
>
> Nice catch!
>
> Reviewed-by: Eric Curtin <ecurtin@redhat.com>
Applied as 6.3-rc material, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-01 18:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27 10:07 [PATCH] cpufreq: apple-soc: Fix an IS_ERR() vs NULL check Dan Carpenter
2023-02-27 10:26 ` Eric Curtin
2023-03-01 18:36 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.