Skip to content

Commit 66e93b2

Browse files
ndreysherbertx
authored andcommitted
crypto: caam - use devres to unmap memory
Use devres to unmap memory and drop corresponding iounmap() call. Signed-off-by: Andrey Smirnov <[email protected]> Reviewed-by: Horia Geantă <[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] Signed-off-by: Herbert Xu <[email protected]>
1 parent fbbfb3f commit 66e93b2

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

drivers/crypto/caam/ctrl.c

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,9 @@ static int caam_remove(struct platform_device *pdev)
308308
{
309309
struct device *ctrldev;
310310
struct caam_drv_private *ctrlpriv;
311-
struct caam_ctrl __iomem *ctrl;
312311

313312
ctrldev = &pdev->dev;
314313
ctrlpriv = dev_get_drvdata(ctrldev);
315-
ctrl = (struct caam_ctrl __iomem *)ctrlpriv->ctrl;
316314

317315
/* Remove platform devices under the crypto node */
318316
of_platform_depopulate(ctrldev);
@@ -334,9 +332,6 @@ static int caam_remove(struct platform_device *pdev)
334332
debugfs_remove_recursive(ctrlpriv->dfs_root);
335333
#endif
336334

337-
/* Unmap controller region */
338-
iounmap(ctrl);
339-
340335
return 0;
341336
}
342337

@@ -611,10 +606,11 @@ static int caam_probe(struct platform_device *pdev)
611606

612607
/* Get configuration properties from device tree */
613608
/* First, get register page */
614-
ctrl = of_iomap(nprop, 0);
615-
if (!ctrl) {
609+
ctrl = devm_of_iomap(dev, nprop, 0, NULL);
610+
ret = PTR_ERR_OR_ZERO(ctrl);
611+
if (ret) {
616612
dev_err(dev, "caam: of_iomap() failed\n");
617-
return -ENOMEM;
613+
return ret;
618614
}
619615

620616
caam_little_end = !(bool)(rd_reg32(&ctrl->perfmon.status) &
@@ -632,22 +628,18 @@ static int caam_probe(struct platform_device *pdev)
632628
if (ctrlpriv->qi_present && !caam_dpaa2) {
633629
ret = qman_is_probed();
634630
if (!ret) {
635-
ret = -EPROBE_DEFER;
636-
goto iounmap_ctrl;
631+
return -EPROBE_DEFER;
637632
} else if (ret < 0) {
638633
dev_err(dev, "failing probe due to qman probe error\n");
639-
ret = -ENODEV;
640-
goto iounmap_ctrl;
634+
return -ENODEV;
641635
}
642636

643637
ret = qman_portals_probed();
644638
if (!ret) {
645-
ret = -EPROBE_DEFER;
646-
goto iounmap_ctrl;
639+
return -EPROBE_DEFER;
647640
} else if (ret < 0) {
648641
dev_err(dev, "failing probe due to qman portals probe error\n");
649-
ret = -ENODEV;
650-
goto iounmap_ctrl;
642+
return -ENODEV;
651643
}
652644
}
653645
#endif
@@ -722,7 +714,7 @@ static int caam_probe(struct platform_device *pdev)
722714
ret = dma_set_mask_and_coherent(dev, caam_get_dma_mask(dev));
723715
if (ret) {
724716
dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n", ret);
725-
goto iounmap_ctrl;
717+
return ret;
726718
}
727719

728720
ctrlpriv->era = caam_get_era(ctrl);
@@ -927,8 +919,6 @@ static int caam_probe(struct platform_device *pdev)
927919
if (ctrlpriv->qi_init)
928920
caam_qi_shutdown(dev);
929921
#endif
930-
iounmap_ctrl:
931-
iounmap(ctrl);
932922
return ret;
933923
}
934924

0 commit comments

Comments
 (0)