mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] bus: qcom-ebi2: unwind clocks on child setup failures
@ 2026-06-16 15:17 Pengpeng Hou
  2026-06-17  9:36 ` Konrad Dybcio
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-16 15:17 UTC (permalink / raw)
  To: Bjorn Andersson; +Cc: Konrad Dybcio, linux-arm-msm, linux-kernel, Pengpeng Hou

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);
+			goto err_disable_clk;
+		}
+	}
+
 	return 0;
 
 err_disable_clk:
-- 
2.43.0


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

* Re: [PATCH] bus: qcom-ebi2: unwind clocks on child setup failures
  2026-06-16 15:17 [PATCH] bus: qcom-ebi2: unwind clocks on child setup failures Pengpeng Hou
@ 2026-06-17  9:36 ` Konrad Dybcio
  0 siblings, 0 replies; 2+ messages in thread
From: Konrad Dybcio @ 2026-06-17  9:36 UTC (permalink / raw)
  To: Pengpeng Hou, Bjorn Andersson; +Cc: Konrad Dybcio, linux-arm-msm, linux-kernel

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

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

end of thread, other threads:[~2026-06-17  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-16 15:17 [PATCH] bus: qcom-ebi2: unwind clocks on child setup failures Pengpeng Hou
2026-06-17  9:36 ` Konrad Dybcio

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®