can: grcan: use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Mon, 30 Sep 2019 09:49:09 +0000 (17:49 +0800)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 11 Nov 2019 20:58:09 +0000 (21:58 +0100)
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: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/grcan.c

index b8f1f2b69dd3e7efda50eb6daf63ef4100516eeb..378200b682fa18751851c232a370590261d92614 100644 (file)
@@ -1652,7 +1652,6 @@ exit_free_candev:
 static int grcan_probe(struct platform_device *ofdev)
 {
        struct device_node *np = ofdev->dev.of_node;
-       struct resource *res;
        u32 sysid, ambafreq;
        int irq, err;
        void __iomem *base;
@@ -1672,8 +1671,7 @@ static int grcan_probe(struct platform_device *ofdev)
                goto exit_error;
        }
 
-       res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
-       base = devm_ioremap_resource(&ofdev->dev, res);
+       base = devm_platform_ioremap_resource(ofdev, 0);
        if (IS_ERR(base)) {
                err = PTR_ERR(base);
                goto exit_error;