crypto: dcp - Use devm_ioremap_resource()
authorFabio Estevam <fabio.estevam@freescale.com>
Sun, 22 Sep 2013 17:42:25 +0000 (14:42 -0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 23 Sep 2013 20:02:24 +0000 (06:02 +1000)
Using devm_ioremap_resource() can make the code simpler and smaller.

When devm_ioremap_resource() is used there is no need to explicitely check the
error returned by platform_get_resource().

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/dcp.c

index a8a7dd4b0d25c6741d47e40b53b9d3cfd7f101ad..90a7cb7fdc9d9672ae14b3b35f5027174ca002eb 100644 (file)
@@ -733,12 +733,7 @@ static int dcp_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, dev);
 
        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!r) {
-               dev_err(&pdev->dev, "failed to get IORESOURCE_MEM\n");
-               return -ENXIO;
-       }
-       dev->dcp_regs_base = devm_ioremap(&pdev->dev, r->start,
-                                         resource_size(r));
+       dev->dcp_regs_base = devm_ioremap_resource(&pdev->dev, r);
 
        dcp_set(dev, DCP_CTRL_SFRST, DCP_REG_CTRL);
        udelay(10);