w1: sgi_w1: use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Wed, 9 Oct 2019 14:44:35 +0000 (22:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Oct 2019 13:24:18 +0000 (15:24 +0200)
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20191009144435.12656-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/w1/masters/sgi_w1.c

index 1b2d96b945beecc7936ccda1a2a29bf536de4213..e8c7fa68d3cc34086468b4aa907b910ab271f11a 100644 (file)
@@ -77,15 +77,13 @@ static int sgi_w1_probe(struct platform_device *pdev)
 {
        struct sgi_w1_device *sdev;
        struct sgi_w1_platform_data *pdata;
-       struct resource *res;
 
        sdev = devm_kzalloc(&pdev->dev, sizeof(struct sgi_w1_device),
                            GFP_KERNEL);
        if (!sdev)
                return -ENOMEM;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       sdev->mcr = devm_ioremap_resource(&pdev->dev, res);
+       sdev->mcr = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(sdev->mcr))
                return PTR_ERR(sdev->mcr);