[PATCH] crypto: caam: depopulate job rings on populate failure
From: Pengpeng Hou
Date: Mon Jun 15 2026 - 20:54:36 EST
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 <pengpeng@xxxxxxxxxxx>
---
drivers/crypto/caam/ctrl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 320be5d77737..716c57b9f89b 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -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;
}
--
2.50.1 (Apple Git-155)