Skip to content

Commit

Permalink
media: platform: Use devm_platform_ioremap_resource() in two functions
Browse files Browse the repository at this point in the history
Simplify these function implementations by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Tested-by: Niklas Söderlund <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
elfring authored and mchehab committed Oct 10, 2019
1 parent 5c9de1f commit d8b1ad7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
8 changes: 1 addition & 7 deletions drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 1 addition & 6 deletions drivers/media/platform/rcar-vin/rcar-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down

0 comments on commit d8b1ad7

Please sign in to comment.