mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>,
	Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bus: qcom-ebi2: unwind clocks on child setup failures
Date: Wed, 17 Jun 2026 11:36:09 +0200	[thread overview]
Message-ID: <d1882207-4756-4e65-ba30-b47ccc821fd4@oss.qualcomm.com> (raw)
In-Reply-To: <20260616151703.23572-1-pengpeng@iscas.ac.cn>

On 6/16/26 5:17 PM, Pengpeng Hou wrote:
> qcom_ebi2_probe() enables both EBI2 clocks before walking child
> chip-select nodes.  A missing child reg property returns directly from
> that loop, bypassing the existing clock-disable labels.
> 
> Route that failure through the existing unwind path.  Also check the
> final child population result, depopulate any partially created children,
> and disable the clocks if population fails.
> 
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
>  drivers/bus/qcom-ebi2.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/bus/qcom-ebi2.c b/drivers/bus/qcom-ebi2.c
> index be8166565e7c..68fe931d1636 100644
> --- a/drivers/bus/qcom-ebi2.c
> +++ b/drivers/bus/qcom-ebi2.c
> @@ -353,7 +353,7 @@ static int qcom_ebi2_probe(struct platform_device *pdev)
>  		/* Figure out the chipselect */
>  		ret = of_property_read_u32(child, "reg", &csindex);
>  		if (ret)
> -			return ret;
> +			goto err_disable_clk;
>  
>  		if (csindex > 5) {
>  			dev_err(dev,
> @@ -372,8 +372,14 @@ static int qcom_ebi2_probe(struct platform_device *pdev)
>  		have_children = true;
>  	}
>  
> -	if (have_children)
> -		return of_platform_default_populate(np, NULL, dev);
> +	if (have_children) {
> +		ret = of_platform_default_populate(np, NULL, dev);
> +		if (ret) {
> +			of_platform_depopulate(dev);

We can use devm_of_platform_populate() instead (which will match any child
node instead of just the simple-bus-y ones, but that's fine) and
devm_clk_get_enabled() to handle what you're addressing here, then we
need no more unwinding

Konrad

      reply	other threads:[~2026-06-17  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 15:17 Pengpeng Hou
2026-06-17  9:36 ` Konrad Dybcio [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=d1882207-4756-4e65-ba30-b47ccc821fd4@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®