Skip to content

Commit 1a1c4f0

Browse files
ndreysherbertx
authored andcommitted
crypto: caam - use devres to populate platform devices
Use devres to de-initialize the RNG and drop explicit de-initialization code in caam_remove(). 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 f414de2 commit 1a1c4f0

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

drivers/crypto/caam/ctrl.c

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -321,20 +321,6 @@ static int instantiate_rng(struct device *ctrldev, int state_handle_mask,
321321
return ret;
322322
}
323323

324-
static int caam_remove(struct platform_device *pdev)
325-
{
326-
struct device *ctrldev;
327-
struct caam_drv_private *ctrlpriv;
328-
329-
ctrldev = &pdev->dev;
330-
ctrlpriv = dev_get_drvdata(ctrldev);
331-
332-
/* Remove platform devices under the crypto node */
333-
of_platform_depopulate(ctrldev);
334-
335-
return 0;
336-
}
337-
338324
/*
339325
* kick_trng - sets the various parameters for enabling the initialization
340326
* of the RNG4 block in CAAM
@@ -761,7 +747,7 @@ static int caam_probe(struct platform_device *pdev)
761747
#endif
762748
}
763749

764-
ret = of_platform_populate(nprop, caam_match, NULL, dev);
750+
ret = devm_of_platform_populate(dev);
765751
if (ret) {
766752
dev_err(dev, "JR platform devices creation error\n");
767753
return ret;
@@ -783,8 +769,7 @@ static int caam_probe(struct platform_device *pdev)
783769
/* If no QI and no rings specified, quit and go home */
784770
if ((!ctrlpriv->qi_present) && (!ctrlpriv->total_jobrs)) {
785771
dev_err(dev, "no queues configured, terminating\n");
786-
ret = -ENOMEM;
787-
goto caam_remove;
772+
return -ENOMEM;
788773
}
789774

790775
if (ctrlpriv->era < 10)
@@ -847,7 +832,7 @@ static int caam_probe(struct platform_device *pdev)
847832
} while ((ret == -EAGAIN) && (ent_delay < RTSDCTL_ENT_DLY_MAX));
848833
if (ret) {
849834
dev_err(dev, "failed to instantiate RNG");
850-
goto caam_remove;
835+
return ret;
851836
}
852837
/*
853838
* Set handles init'ed by this module as the complement of the
@@ -921,10 +906,6 @@ static int caam_probe(struct platform_device *pdev)
921906
&ctrlpriv->ctl_tdsk_wrap);
922907
#endif
923908
return 0;
924-
925-
caam_remove:
926-
caam_remove(pdev);
927-
return ret;
928909
}
929910

930911
static struct platform_driver caam_driver = {
@@ -933,7 +914,6 @@ static struct platform_driver caam_driver = {
933914
.of_match_table = caam_match,
934915
},
935916
.probe = caam_probe,
936-
.remove = caam_remove,
937917
};
938918

939919
module_platform_driver(caam_driver);

0 commit comments

Comments
 (0)