sh_eth: Use devm_platform_get_and_ioremap_resource()
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 8 Jun 2021 13:57:18 +0000 (21:57 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Jun 2021 23:38:03 +0000 (16:38 -0700)
Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Sergei Shtylyov <sergei.shtylyov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c

index c5b1548..177523b 100644 (file)
@@ -3225,9 +3225,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
        struct net_device *ndev;
        int ret;
 
-       /* get base addr */
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
        ndev = alloc_etherdev(sizeof(struct sh_eth_private));
        if (!ndev)
                return -ENOMEM;
@@ -3245,7 +3242,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
        mdp = netdev_priv(ndev);
        mdp->num_tx_ring = TX_RING_SIZE;
        mdp->num_rx_ring = RX_RING_SIZE;
-       mdp->addr = devm_ioremap_resource(&pdev->dev, res);
+       mdp->addr = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
        if (IS_ERR(mdp->addr)) {
                ret = PTR_ERR(mdp->addr);
                goto out_release;