]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 18 Jun 2019 11:54:10 +0000 (14:54 +0300)
committerOlof Johansson <olof@lixom.net>
Tue, 18 Jun 2019 13:47:59 +0000 (06:47 -0700)
The devm_ioremap_resource() function doesn't return NULL, it returns
error pointers.

Fixes: 0b458d7b10f8 ("soc: ixp4xx: npe: Pass addresses as resources")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
drivers/soc/ixp4xx/ixp4xx-npe.c

index bc10e3194809a64666f48819d2a51a40a681dda3..ec90b44fa0cd327cf32fcc76ba3eb5ba916eba94 100644 (file)
@@ -695,8 +695,8 @@ static int ixp4xx_npe_probe(struct platform_device *pdev)
                        continue; /* NPE already disabled or not present */
                }
                npe->regs = devm_ioremap_resource(dev, res);
-               if (!npe->regs)
-                       return -ENOMEM;
+               if (IS_ERR(npe->regs))
+                       return PTR_ERR(npe->regs);
 
                if (npe_reset(npe)) {
                        dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n",