Skip to content

Commit

Permalink
net: mdio: mscc-miim: Use devm_platform_get_and_ioremap_resource()
Browse files Browse the repository at this point in the history
Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Yang Yingliang authored and davem330 committed Jun 11, 2021
1 parent 975f626 commit 8ee1a0e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/net/mdio/mdio-mscc-miim.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ static int mscc_miim_probe(struct platform_device *pdev)
struct mscc_miim_dev *dev;
int ret;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;

bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*dev));
if (!bus)
return -ENOMEM;
Expand All @@ -155,7 +151,7 @@ static int mscc_miim_probe(struct platform_device *pdev)
bus->parent = &pdev->dev;

dev = bus->priv;
dev->regs = devm_ioremap_resource(&pdev->dev, res);
dev->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
if (IS_ERR(dev->regs)) {
dev_err(&pdev->dev, "Unable to map MIIM registers\n");
return PTR_ERR(dev->regs);
Expand Down

0 comments on commit 8ee1a0e

Please sign in to comment.