]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: rzn1-a5psw: fix a NULL vs IS_ERR() check in a5psw_probe()
authorPeng Wu <wupeng58@huawei.com>
Tue, 28 Jun 2022 13:09:20 +0000 (13:09 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 30 Jun 2022 03:57:11 +0000 (20:57 -0700)
The devm_platform_ioremap_resource() function never returns NULL.
It returns error pointers.

Signed-off-by: Peng Wu <wupeng58@huawei.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Clément Léger <clement.leger@bootlin.com>
Link: https://lore.kernel.org/r/20220628130920.49493-1-wupeng58@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/rzn1_a5psw.c

index 3e910da98ae2441220d44e0b861ac0d2bbbaf92b..5b14e2ba9b79a961ba78cc5d2fad32fafa79cdfd 100644 (file)
@@ -946,8 +946,8 @@ static int a5psw_probe(struct platform_device *pdev)
        mutex_init(&a5psw->lk_lock);
        spin_lock_init(&a5psw->reg_lock);
        a5psw->base = devm_platform_ioremap_resource(pdev, 0);
-       if (!a5psw->base)
-               return -EINVAL;
+       if (IS_ERR(a5psw->base))
+               return PTR_ERR(a5psw->base);
 
        ret = a5psw_pcs_get(a5psw);
        if (ret)