Skip to content

Commit 05d2a75

Browse files
ndreysherbertx
authored andcommitted
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 <[email protected]> Cc: Chris Healy <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Horia Geantă <[email protected]> Cc: Herbert Xu <[email protected]> Cc: Iuliana Prodan <[email protected]> Cc: [email protected] Cc: [email protected] Reviewed-by: Horia Geantă <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 796114f commit 05d2a75

File tree

1 file changed

+9
-4
lines changed
  • drivers/crypto/caam

1 file changed

+9
-4
lines changed

drivers/crypto/caam/jr.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ static int caam_jr_probe(struct platform_device *pdev)
498498
struct caam_job_ring __iomem *ctrl;
499499
struct caam_drv_private_jr *jrpriv;
500500
static int total_jobrs;
501+
struct resource *r;
501502
int error;
502503

503504
jrdev = &pdev->dev;
@@ -513,9 +514,15 @@ static int caam_jr_probe(struct platform_device *pdev)
513514
nprop = pdev->dev.of_node;
514515
/* Get configuration properties from device tree */
515516
/* First, get register page */
516-
ctrl = of_iomap(nprop, 0);
517+
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
518+
if (!r) {
519+
dev_err(jrdev, "platform_get_resource() failed\n");
520+
return -ENOMEM;
521+
}
522+
523+
ctrl = devm_ioremap(jrdev, r->start, resource_size(r));
517524
if (!ctrl) {
518-
dev_err(jrdev, "of_iomap() failed\n");
525+
dev_err(jrdev, "devm_ioremap() failed\n");
519526
return -ENOMEM;
520527
}
521528

@@ -525,7 +532,6 @@ static int caam_jr_probe(struct platform_device *pdev)
525532
if (error) {
526533
dev_err(jrdev, "dma_set_mask_and_coherent failed (%d)\n",
527534
error);
528-
iounmap(ctrl);
529535
return error;
530536
}
531537

@@ -536,7 +542,6 @@ static int caam_jr_probe(struct platform_device *pdev)
536542
error = caam_jr_init(jrdev); /* now turn on hardware */
537543
if (error) {
538544
irq_dispose_mapping(jrpriv->irq);
539-
iounmap(ctrl);
540545
return error;
541546
}
542547

0 commit comments

Comments
 (0)