Commit 969b002d authored by Rosen Penev's avatar Rosen Penev Committed by Jakub Kicinski

net: ibm: emac: use devm for of_iomap

Allows removing manual iounmap.
Signed-off-by: default avatarRosen Penev <rosenp@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20240912024903.6201-4-rosenp@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent dcc34ef7
...@@ -3084,9 +3084,9 @@ static int emac_probe(struct platform_device *ofdev) ...@@ -3084,9 +3084,9 @@ static int emac_probe(struct platform_device *ofdev)
/* Map EMAC regs */ /* Map EMAC regs */
// TODO : platform_get_resource() and devm_ioremap_resource() // TODO : platform_get_resource() and devm_ioremap_resource()
dev->emacp = of_iomap(np, 0); dev->emacp = devm_of_iomap(&ofdev->dev, np, 0, NULL);
if (dev->emacp == NULL) { if (!dev->emacp) {
printk(KERN_ERR "%pOF: Can't map device registers!\n", np); dev_err(&ofdev->dev, "can't map device registers");
err = -ENOMEM; err = -ENOMEM;
goto err_irq_unmap; goto err_irq_unmap;
} }
...@@ -3097,7 +3097,7 @@ static int emac_probe(struct platform_device *ofdev) ...@@ -3097,7 +3097,7 @@ static int emac_probe(struct platform_device *ofdev)
printk(KERN_ERR printk(KERN_ERR
"%pOF: Timeout waiting for dependent devices\n", np); "%pOF: Timeout waiting for dependent devices\n", np);
/* display more info about what's missing ? */ /* display more info about what's missing ? */
goto err_reg_unmap; goto err_irq_unmap;
} }
dev->mal = platform_get_drvdata(dev->mal_dev); dev->mal = platform_get_drvdata(dev->mal_dev);
if (dev->mdio_dev != NULL) if (dev->mdio_dev != NULL)
...@@ -3230,8 +3230,6 @@ static int emac_probe(struct platform_device *ofdev) ...@@ -3230,8 +3230,6 @@ static int emac_probe(struct platform_device *ofdev)
mal_unregister_commac(dev->mal, &dev->commac); mal_unregister_commac(dev->mal, &dev->commac);
err_rel_deps: err_rel_deps:
emac_put_deps(dev); emac_put_deps(dev);
err_reg_unmap:
iounmap(dev->emacp);
err_irq_unmap: err_irq_unmap:
if (dev->wol_irq) if (dev->wol_irq)
irq_dispose_mapping(dev->wol_irq); irq_dispose_mapping(dev->wol_irq);
...@@ -3276,8 +3274,6 @@ static void emac_remove(struct platform_device *ofdev) ...@@ -3276,8 +3274,6 @@ static void emac_remove(struct platform_device *ofdev)
mal_unregister_commac(dev->mal, &dev->commac); mal_unregister_commac(dev->mal, &dev->commac);
emac_put_deps(dev); emac_put_deps(dev);
iounmap(dev->emacp);
if (dev->wol_irq) if (dev->wol_irq)
irq_dispose_mapping(dev->wol_irq); irq_dispose_mapping(dev->wol_irq);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment