Skip to content

Commit

Permalink
net: Fix return value about devm_platform_ioremap_resource()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Tiezhu Yang authored and davem330 committed May 23, 2020
1 parent d04322a commit ef24d6c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion drivers/net/can/ifi_canfd/ifi_canfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/can/sun4i_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/dsa/b53/b53_srab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/marvell/pxa168_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ef24d6c

Please sign in to comment.