media: platform: Use devm_platform_ioremap_resource() in two functions
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 18 Sep 2019 09:20:48 +0000 (06:20 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 10 Oct 2019 10:29:07 +0000 (07:29 -0300)
Simplify these function implementations by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
drivers/media/platform/rcar-vin/rcar-core.c

index 00d090df11bbe49361ace483c0070b581e798bdc..944771ee5f5cf430b8fce03c537473f7cbe651c8 100644 (file)
@@ -253,13 +253,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
        }
 
        for (i = 0; i < NUM_MAX_VDEC_REG_BASE; i++) {
-               res = platform_get_resource(pdev, IORESOURCE_MEM, i);
-               if (res == NULL) {
-                       dev_err(&pdev->dev, "get memory resource failed.");
-                       ret = -ENXIO;
-                       goto err_res;
-               }
-               dev->reg_base[i] = devm_ioremap_resource(&pdev->dev, res);
+               dev->reg_base[i] = devm_platform_ioremap_resource(pdev, i);
                if (IS_ERR((__force void *)dev->reg_base[i])) {
                        ret = PTR_ERR((__force void *)dev->reg_base[i]);
                        goto err_res;
index 6993484ff0f393ff1e144da06fb9ae73cf9c34fa..334c62805959cc8a1e883cc3f87a69b3ca534279 100644 (file)
@@ -1282,7 +1282,6 @@ static int rcar_vin_probe(struct platform_device *pdev)
 {
        const struct soc_device_attribute *attr;
        struct rvin_dev *vin;
-       struct resource *mem;
        int irq, ret;
 
        vin = devm_kzalloc(&pdev->dev, sizeof(*vin), GFP_KERNEL);
@@ -1301,11 +1300,7 @@ static int rcar_vin_probe(struct platform_device *pdev)
        if (attr)
                vin->info = attr->data;
 
-       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (mem == NULL)
-               return -EINVAL;
-
-       vin->base = devm_ioremap_resource(vin->dev, mem);
+       vin->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(vin->base))
                return PTR_ERR(vin->base);