crypto: caam - use devres to unmap JR's registers
Use devres to unmap memory and drop explicit de-initialization code. NOTE: There's no corresponding unmapping code in caam_jr_remove which seems like a resource leak. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Chris Healy <cphealy@gmail.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Horia Geantă <horia.geanta@nxp.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Iuliana Prodan <iuliana.prodan@nxp.com> Cc: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Horia Geantă <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
796114f5c5
commit
05d2a75441
|
@ -498,6 +498,7 @@ static int caam_jr_probe(struct platform_device *pdev)
|
||||||
struct caam_job_ring __iomem *ctrl;
|
struct caam_job_ring __iomem *ctrl;
|
||||||
struct caam_drv_private_jr *jrpriv;
|
struct caam_drv_private_jr *jrpriv;
|
||||||
static int total_jobrs;
|
static int total_jobrs;
|
||||||
|
struct resource *r;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
jrdev = &pdev->dev;
|
jrdev = &pdev->dev;
|
||||||
|
@ -513,9 +514,15 @@ static int caam_jr_probe(struct platform_device *pdev)
|
||||||
nprop = pdev->dev.of_node;
|
nprop = pdev->dev.of_node;
|
||||||
/* Get configuration properties from device tree */
|
/* Get configuration properties from device tree */
|
||||||
/* First, get register page */
|
/* First, get register page */
|
||||||
ctrl = of_iomap(nprop, 0);
|
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
|
if (!r) {
|
||||||
|
dev_err(jrdev, "platform_get_resource() failed\n");
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctrl = devm_ioremap(jrdev, r->start, resource_size(r));
|
||||||
if (!ctrl) {
|
if (!ctrl) {
|
||||||
dev_err(jrdev, "of_iomap() failed\n");
|
dev_err(jrdev, "devm_ioremap() failed\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,7 +532,6 @@ static int caam_jr_probe(struct platform_device *pdev)
|
||||||
if (error) {
|
if (error) {
|
||||||
dev_err(jrdev, "dma_set_mask_and_coherent failed (%d)\n",
|
dev_err(jrdev, "dma_set_mask_and_coherent failed (%d)\n",
|
||||||
error);
|
error);
|
||||||
iounmap(ctrl);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,7 +542,6 @@ static int caam_jr_probe(struct platform_device *pdev)
|
||||||
error = caam_jr_init(jrdev); /* now turn on hardware */
|
error = caam_jr_init(jrdev); /* now turn on hardware */
|
||||||
if (error) {
|
if (error) {
|
||||||
irq_dispose_mapping(jrpriv->irq);
|
irq_dispose_mapping(jrpriv->irq);
|
||||||
iounmap(ctrl);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue