net: dsa: b53: use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Thu, 1 Aug 2019 12:27:32 +0000 (20:27 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Aug 2019 17:10:34 +0000 (13:10 -0400)
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/dsa/b53/b53_srab.c

index d9c56a779c088e3b68913615ffb000e742026caa..0a1be5259be0c911d6e9fc5f18c3447c2e58bc46 100644 (file)
@@ -536,7 +536,6 @@ static void b53_srab_mux_init(struct platform_device *pdev)
        struct b53_device *dev = platform_get_drvdata(pdev);
        struct b53_srab_priv *priv = dev->priv;
        struct b53_srab_port_priv *p;
-       struct resource *r;
        unsigned int port;
        u32 reg, off = 0;
        int ret;
@@ -544,8 +543,7 @@ static void b53_srab_mux_init(struct platform_device *pdev)
        if (dev->pdata && dev->pdata->chip_id != BCM58XX_DEVICE_ID)
                return;
 
-       r = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       priv->mux_config = devm_ioremap_resource(&pdev->dev, r);
+       priv->mux_config = devm_platform_ioremap_resource(pdev, 1);
        if (IS_ERR(priv->mux_config))
                return;
 
@@ -593,7 +591,6 @@ static int b53_srab_probe(struct platform_device *pdev)
        const struct of_device_id *of_id = NULL;
        struct b53_srab_priv *priv;
        struct b53_device *dev;
-       struct resource *r;
 
        if (dn)
                of_id = of_match_node(b53_srab_of_match, dn);
@@ -610,8 +607,7 @@ static int b53_srab_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
-       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       priv->regs = devm_ioremap_resource(&pdev->dev, r);
+       priv->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(priv->regs))
                return -ENOMEM;