* [PATCH] soc: fsl: guts: fix IS_ERR() vs NULL bug
@ 2022-07-04 10:55 Dan Carpenter
2022-07-04 11:01 ` Michael Walle
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-07-04 10:55 UTC (permalink / raw)
To: Li Yang, Michael Walle
Cc: linuxppc-dev, kernel-janitors, Shawn Guo, linux-arm-kernel,
Arnd Bergmann
The of_iomap() function returns NULL on failure, it never returns
error pointers.
Fixes: ab4988d6a393 ("soc: fsl: guts: embed fsl_guts_get_svr() in probe()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/soc/fsl/guts.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 27035de062f8..8038c599ad83 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -195,9 +195,9 @@ static int __init fsl_guts_init(void)
soc_data = match->data;
regs = of_iomap(np, 0);
- if (IS_ERR(regs)) {
+ if (!regs) {
of_node_put(np);
- return PTR_ERR(regs);
+ return -ENOMEM;
}
little_endian = of_property_read_bool(np, "little-endian");
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] soc: fsl: guts: fix IS_ERR() vs NULL bug
2022-07-04 10:55 [PATCH] soc: fsl: guts: fix IS_ERR() vs NULL bug Dan Carpenter
@ 2022-07-04 11:01 ` Michael Walle
0 siblings, 0 replies; 2+ messages in thread
From: Michael Walle @ 2022-07-04 11:01 UTC (permalink / raw)
To: Dan Carpenter
Cc: Arnd Bergmann, Shawn Guo, kernel-janitors, Li Yang, linuxppc-dev,
linux-arm-kernel
Am 2022-07-04 12:55, schrieb Dan Carpenter:
> The of_iomap() function returns NULL on failure, it never returns
> error pointers.
>
> Fixes: ab4988d6a393 ("soc: fsl: guts: embed fsl_guts_get_svr() in
> probe()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/soc/fsl/guts.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
> index 27035de062f8..8038c599ad83 100644
> --- a/drivers/soc/fsl/guts.c
> +++ b/drivers/soc/fsl/guts.c
> @@ -195,9 +195,9 @@ static int __init fsl_guts_init(void)
> soc_data = match->data;
>
> regs = of_iomap(np, 0);
> - if (IS_ERR(regs)) {
> + if (!regs) {
> of_node_put(np);
> - return PTR_ERR(regs);
> + return -ENOMEM;
> }
>
> little_endian = of_property_read_bool(np, "little-endian");
There was already a patch for this:
https://lore.kernel.org/lkml/20220628140249.1073809-1-yangyingliang@huawei.com/
-michael
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-04 11:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-04 10:55 [PATCH] soc: fsl: guts: fix IS_ERR() vs NULL bug Dan Carpenter
2022-07-04 11:01 ` Michael Walle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).