Skip to content

Commit 969b002

Browse files
nehebkuba-moo
authored andcommitted
net: ibm: emac: use devm for of_iomap
Allows removing manual iounmap. Signed-off-by: Rosen Penev <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent dcc34ef commit 969b002

File tree

1 file changed

+4
-8
lines changed
  • drivers/net/ethernet/ibm/emac

1 file changed

+4
-8
lines changed

drivers/net/ethernet/ibm/emac/core.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3084,9 +3084,9 @@ static int emac_probe(struct platform_device *ofdev)
30843084

30853085
/* Map EMAC regs */
30863086
// TODO : platform_get_resource() and devm_ioremap_resource()
3087-
dev->emacp = of_iomap(np, 0);
3088-
if (dev->emacp == NULL) {
3089-
printk(KERN_ERR "%pOF: Can't map device registers!\n", np);
3087+
dev->emacp = devm_of_iomap(&ofdev->dev, np, 0, NULL);
3088+
if (!dev->emacp) {
3089+
dev_err(&ofdev->dev, "can't map device registers");
30903090
err = -ENOMEM;
30913091
goto err_irq_unmap;
30923092
}
@@ -3097,7 +3097,7 @@ static int emac_probe(struct platform_device *ofdev)
30973097
printk(KERN_ERR
30983098
"%pOF: Timeout waiting for dependent devices\n", np);
30993099
/* display more info about what's missing ? */
3100-
goto err_reg_unmap;
3100+
goto err_irq_unmap;
31013101
}
31023102
dev->mal = platform_get_drvdata(dev->mal_dev);
31033103
if (dev->mdio_dev != NULL)
@@ -3230,8 +3230,6 @@ static int emac_probe(struct platform_device *ofdev)
32303230
mal_unregister_commac(dev->mal, &dev->commac);
32313231
err_rel_deps:
32323232
emac_put_deps(dev);
3233-
err_reg_unmap:
3234-
iounmap(dev->emacp);
32353233
err_irq_unmap:
32363234
if (dev->wol_irq)
32373235
irq_dispose_mapping(dev->wol_irq);
@@ -3276,8 +3274,6 @@ static void emac_remove(struct platform_device *ofdev)
32763274
mal_unregister_commac(dev->mal, &dev->commac);
32773275
emac_put_deps(dev);
32783276

3279-
iounmap(dev->emacp);
3280-
32813277
if (dev->wol_irq)
32823278
irq_dispose_mapping(dev->wol_irq);
32833279
}

0 commit comments

Comments
 (0)