Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: "Horia Geantă" <horia.geanta@nxp.com>,
	"Pankaj Gupta" <pankaj.gupta@nxp.com>,
	"Gaurav Jain" <gaurav.jain@nxp.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: caam: depopulate job rings on populate failure
Date: Fri, 3 Jul 2026 17:14:17 +0800	[thread overview]
Message-ID: <akd9affKSWuznl0U@gondor.apana.org.au> (raw)
In-Reply-To: <20260616005239.6655-1-pengpeng@iscas.ac.cn>

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

      reply	other threads:[~2026-07-03  9:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16  0:52 [PATCH] crypto: caam: depopulate job rings on populate failure Pengpeng Hou
2026-07-03  9:14 ` Herbert Xu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=akd9affKSWuznl0U@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=gaurav.jain@nxp.com \
    --cc=horia.geanta@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pankaj.gupta@nxp.com \
    --cc=pengpeng@iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox