From: Markus Elfring <elfr...@users.sourceforge.net>
Date: Fri, 27 Sep 2019 09:24:03 +0200

Simplify this function implementation a bit by using
a known wrapper function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfr...@users.sourceforge.net>
---

v2:
Alexandre Belloni pointed the need for adjustments out.
https://lore.kernel.org/r/20190926193239.gc6...@piout.net/

* The mapping of internal phy registers should be treated as optional.
* An other prefix would be preferred in the commit subject.


 drivers/net/phy/mdio-mscc-miim.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/phy/mdio-mscc-miim.c b/drivers/net/phy/mdio-mscc-miim.c
index badbc99bedd3..aabb13982251 100644
--- a/drivers/net/phy/mdio-mscc-miim.c
+++ b/drivers/net/phy/mdio-mscc-miim.c
@@ -120,10 +120,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;
@@ -136,7 +132,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_ioremap_resource(pdev, 0);
        if (IS_ERR(dev->regs)) {
                dev_err(&pdev->dev, "Unable to map MIIM registers\n");
                return PTR_ERR(dev->regs);
--
2.23.0

Reply via email to