soc: fsl: guts: fix return value check in fsl_guts_init()
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 28 Jun 2022 14:02:48 +0000 (22:02 +0800)
committerShawn Guo <shawnguo@kernel.org>
Tue, 5 Jul 2022 00:41:20 +0000 (08:41 +0800)
In case of error, of_iomap() returns NULL pointer not ERR_PTR().
The IS_ERR() test in the return value check should be replaced
with NULL test and return -ENOMEM as error value.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
drivers/soc/fsl/guts.c

index 27035de062f89c4fa8814a56e4cdfdca85b9a042..8038c599ad839b4278da60804faf265c102512d6 100644 (file)
@@ -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");