crypto: caam: depopulate job rings on populate failure
PATCH 1/1 crypto: caam: depopulate job rings on populate failure
devm_of_platform_populate() only registers its automatic cleanup action after child population succeeds. If CAAM job-ring population fails after creating some job-ring devices, the probe error path reports the error but leaves the partial children registered.
Explicitly depopulate the job-ring children on the populate failure path.
--- drivers/crypto/caam/ctrl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/caam/ctrl.c +3 -1
@@ -1150,8 +1150,10 @@ static int caam_probe(struct platform_device *pdev) ctrlpriv->total_jobrs, ctrlpriv->qi_present); ret =devm_of_platform_populate (dev); -if (ret) +if (ret) {dev_err (dev,"JR platform devices creation error\n" ); +of_platform_depopulate (dev); + }return ret; }
Signature · 1 line
2.50.1 (Apple Git-155)
Herbert Xu
maintainerQuoted 17 lines · Pengpeng Hou
devm_of_platform_populate()only registers its automatic cleanup action after child population succeeds. If CAAM job-ring population fails after creating some job-ring devices, the probe error path reports the error but leaves the partial children registered.Explicitly depopulate the job-ring children on the populate failure path.
Signed-off-by Pengpeng Hou <[email protected]>--- drivers/crypto/caam/ctrl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/crypto/caam/ctrl.c +0
-0
drivers/crypto/caam/ctrl.c static int caam_probe(struct platform_device *pdev) · line 1156
Quoted 8 lines
drivers/crypto/caam/ctrl.c +3
-1@@ -1150,8 +1150,10 @@ static int caam_probe(struct platform_device *pdev) ctrlpriv->total_jobrs, ctrlpriv->qi_present); ret =devm_of_platform_populate (dev); -if (ret) +if (ret) {dev_err (dev,"JR platform devices creation error\n" ); +of_platform_depopulate (dev); + }
This seems counter-intuitive. Why is this necessary and if it is, why isn't this just a bug in devm_of_platform_populate?
Cheers,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt