net: Fix return value about devm_platform_ioremap_resource()
authorTiezhu Yang <yangtiezhu@loongson.cn>
Fri, 22 May 2020 11:03:21 +0000 (19:03 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 23 May 2020 23:28:25 +0000 (16:28 -0700)
When call function devm_platform_ioremap_resource(), we should use IS_ERR()
to check the return value and return PTR_ERR() if failed.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/can/ifi_canfd/ifi_canfd.c
drivers/net/can/sun4i_can.c
drivers/net/dsa/b53/b53_srab.c
drivers/net/ethernet/marvell/pxa168_eth.c

index 04d59be..74503ca 100644 (file)
@@ -947,8 +947,11 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev)
        u32 id, rev;
 
        addr = devm_platform_ioremap_resource(pdev, 0);
+       if (IS_ERR(addr))
+               return PTR_ERR(addr);
+
        irq = platform_get_irq(pdev, 0);
-       if (IS_ERR(addr) || irq < 0)
+       if (irq < 0)
                return -EINVAL;
 
        id = readl(addr + IFI_CANFD_IP_ID);
index e3ba8ab..e2c6cf4 100644 (file)
@@ -792,7 +792,7 @@ static int sun4ican_probe(struct platform_device *pdev)
 
        addr = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(addr)) {
-               err = -EBUSY;
+               err = PTR_ERR(addr);
                goto exit;
        }
 
index 0a1be52..38cd828 100644 (file)
@@ -609,7 +609,7 @@ static int b53_srab_probe(struct platform_device *pdev)
 
        priv->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(priv->regs))
-               return -ENOMEM;
+               return PTR_ERR(priv->regs);
 
        dev = b53_switch_alloc(&pdev->dev, &b53_srab_ops, priv);
        if (!dev)
index 7a0d785..17243bb 100644 (file)
@@ -1418,7 +1418,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 
        pep->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(pep->base)) {
-               err = -ENOMEM;
+               err = PTR_ERR(pep->base);
                goto err_netdev;
        }