net: stmmac: dwmac-anarion: use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Wed, 21 Aug 2019 13:55:50 +0000 (21:55 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 21 Aug 2019 20:52:33 +0000 (13:52 -0700)
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c

index 6ce3a7fb41ab54e85fcedda8384580baebef5a5b..527f93320a5aebb2fe18ea75e0d76085c28e0fec 100644 (file)
@@ -62,12 +62,10 @@ static void anarion_gmac_exit(struct platform_device *pdev, void *priv)
 static struct anarion_gmac *anarion_config_dt(struct platform_device *pdev)
 {
        int phy_mode;
-       struct resource *res;
        void __iomem *ctl_block;
        struct anarion_gmac *gmac;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       ctl_block = devm_ioremap_resource(&pdev->dev, res);
+       ctl_block = devm_platform_ioremap_resource(pdev, 1);
        if (IS_ERR(ctl_block)) {
                dev_err(&pdev->dev, "Cannot get reset region (%ld)!\n",
                        PTR_ERR(ctl_block));