]> git.baikalelectronics.ru Git - kernel.git/commitdiff
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 04d59bede5ea2ce72390d994edf87472db5e4e4f..74503cacf59418797a2cdb3f642ded4b7e373bad 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 e3ba8ab0cbf44c977ec096deba9dcb9af18648fe..e2c6cf4b2228f0eeb0752a35d54275a7f2acefed 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 0a1be5259be0c911d6e9fc5f18c3447c2e58bc46..38cd8285ac6793c9bc27013e495941096e36ef21 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 7a0d785b826c6f909ce79788b2d4a887ae0a379d..17243bb5ba9102e26de9f2f3c0f57f445e040888 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;
        }