Re: [PATCH] bus: qcom-ebi2: unwind clocks on child setup failures

From: Konrad Dybcio

Date: Wed Jun 17 2026 - 05:42:51 EST


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@xxxxxxxxxxx>
> ---
> 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