net: ethernet: ti: use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Wed, 21 Aug 2019 12:48:50 +0000 (20:48 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 21 Aug 2019 20:42:12 +0000 (13:42 -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>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpsw.c

index 32a89744972db40c866ade7dccbd2c2232f7ec00..54010957da5cff5d505e272eb799b49f618a243e 100644 (file)
@@ -2764,7 +2764,7 @@ static int cpsw_probe(struct platform_device *pdev)
        struct net_device               *ndev;
        struct cpsw_priv                *priv;
        void __iomem                    *ss_regs;
-       struct resource                 *res, *ss_res;
+       struct resource                 *ss_res;
        struct gpio_descs               *mode;
        const struct soc_device_attribute *soc;
        struct cpsw_common              *cpsw;
@@ -2798,8 +2798,7 @@ static int cpsw_probe(struct platform_device *pdev)
                return PTR_ERR(ss_regs);
        cpsw->regs = ss_regs;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       cpsw->wr_regs = devm_ioremap_resource(dev, res);
+       cpsw->wr_regs = devm_platform_ioremap_resource(pdev, 1);
        if (IS_ERR(cpsw->wr_regs))
                return PTR_ERR(cpsw->wr_regs);