Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH] crypto: caam: depopulate job rings on populate failure
@ 2026-06-16  0:52 Pengpeng Hou
  2026-07-03  9:14 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-16  0:52 UTC (permalink / raw)
  To: Horia Geantă, Pankaj Gupta, Gaurav Jain, Herbert Xu,
	David S. Miller, linux-crypto, linux-kernel
  Cc: 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 <pengpeng@iscas.ac.cn>
---
 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)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: caam: depopulate job rings on populate failure
  2026-06-16  0:52 [PATCH] crypto: caam: depopulate job rings on populate failure Pengpeng Hou
@ 2026-07-03  9:14 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-07-03  9:14 UTC (permalink / raw)
  To: Pengpeng Hou
  Cc: Horia Geantă, Pankaj Gupta, Gaurav Jain, David S. Miller,
	linux-crypto, linux-kernel

On Tue, Jun 16, 2026 at 08:52:39AM +0800, Pengpeng Hou wrote:
> 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@iscas.ac.cn>
> ---
>  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);
> +	}

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,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-03  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-16  0:52 [PATCH] crypto: caam: depopulate job rings on populate failure Pengpeng Hou
2026-07-03  9:14 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox