Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dma: mmp: simplify use of devm_ioremap_resource

Remove unneeded error handling on the result of a call to
platform_get_resource when the value is passed to devm_ioremap_resource.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression pdev,res,n,e,e1;
expression ret != 0;
identifier l;
@@

- res = platform_get_resource(pdev, IORESOURCE_MEM, n);
... when != res
- if (res == NULL) { ... \(goto l;\|return ret;\) }
... when != res
+ res = platform_get_resource(pdev, IORESOURCE_MEM, n);
e = devm_ioremap_resource(e1, res);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

authored by

Julia Lawall and committed by
Vinod Koul
f2d04c32 6fc4573c

-6
-3
drivers/dma/mmp_pdma.c
··· 843 843 spin_lock_init(&pdev->phy_lock); 844 844 845 845 iores = platform_get_resource(op, IORESOURCE_MEM, 0); 846 - if (!iores) 847 - return -EINVAL; 848 - 849 846 pdev->base = devm_ioremap_resource(pdev->dev, iores); 850 847 if (IS_ERR(pdev->base)) 851 848 return PTR_ERR(pdev->base);
-3
drivers/dma/mmp_tdma.c
··· 550 550 } 551 551 552 552 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 553 - if (!iores) 554 - return -EINVAL; 555 - 556 553 tdev->base = devm_ioremap_resource(&pdev->dev, iores); 557 554 if (IS_ERR(tdev->base)) 558 555 return PTR_ERR(tdev->base);