net: mvneta: use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Wed, 21 Aug 2019 13:33:02 +0000 (21:33 +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/marvell/mvneta_bm.c

index 82ee2bcca6fd2eb48c85d7966b593b61985a631e..46c942ef2287f37692be285fde956d7937e11f9e 100644 (file)
@@ -411,15 +411,13 @@ static int mvneta_bm_probe(struct platform_device *pdev)
 {
        struct device_node *dn = pdev->dev.of_node;
        struct mvneta_bm *priv;
-       struct resource *res;
        int err;
 
        priv = devm_kzalloc(&pdev->dev, sizeof(struct mvneta_bm), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       priv->reg_base = devm_ioremap_resource(&pdev->dev, res);
+       priv->reg_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(priv->reg_base))
                return PTR_ERR(priv->reg_base);