The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: geni: depopulate children on populate failure
@ 2026-06-16  0:51 Pengpeng Hou
  2026-07-11 18:17 ` Bjorn Andersson
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-16  0:51 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, linux-arm-msm, linux-kernel; +Cc: Pengpeng Hou

devm_of_platform_populate() installs its devres cleanup action only after
of_platform_populate() succeeds.  If child population fails after creating
some GENI children, those partial children are not automatically removed
by devres because the action was never added.

Depopulate the children explicitly when devm_of_platform_populate()
returns an error.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/soc/qcom/qcom-geni-se.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
index cd1779b6a91a..46dd7b7a8f90 100644
--- a/drivers/soc/qcom/qcom-geni-se.c
+++ b/drivers/soc/qcom/qcom-geni-se.c
@@ -1406,7 +1406,11 @@ static int geni_se_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(dev, wrapper);
 	dev_dbg(dev, "GENI SE Driver probed\n");
-	return devm_of_platform_populate(dev);
+	ret = devm_of_platform_populate(dev);
+	if (ret)
+		of_platform_depopulate(dev);
+
+	return ret;
 }
 
 static const char * const qup_clks[] = {
-- 
2.50.1 (Apple Git-155)


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

* Re: [PATCH] soc: qcom: geni: depopulate children on populate failure
  2026-06-16  0:51 [PATCH] soc: qcom: geni: depopulate children on populate failure Pengpeng Hou
@ 2026-07-11 18:17 ` Bjorn Andersson
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Andersson @ 2026-07-11 18:17 UTC (permalink / raw)
  To: Pengpeng Hou; +Cc: Konrad Dybcio, linux-arm-msm, linux-kernel

On Tue, Jun 16, 2026 at 08:51:18AM +0800, Pengpeng Hou wrote:
> devm_of_platform_populate() installs its devres cleanup action only after
> of_platform_populate() succeeds.

And if it fails it runs the cleanup function.

> If child population fails after creating
> some GENI children, those partial children are not automatically removed
> by devres because the action was never added.

Did you test this?

> 
> Depopulate the children explicitly when devm_of_platform_populate()
> returns an error.
> 

For now I'll consider this patch to be wrong, please fix
devm_of_platform_populate() if your analysis is correct.

Thanks,
Bjorn

> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
>  drivers/soc/qcom/qcom-geni-se.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
> index cd1779b6a91a..46dd7b7a8f90 100644
> --- a/drivers/soc/qcom/qcom-geni-se.c
> +++ b/drivers/soc/qcom/qcom-geni-se.c
> @@ -1406,7 +1406,11 @@ static int geni_se_probe(struct platform_device *pdev)
>  
>  	dev_set_drvdata(dev, wrapper);
>  	dev_dbg(dev, "GENI SE Driver probed\n");
> -	return devm_of_platform_populate(dev);
> +	ret = devm_of_platform_populate(dev);
> +	if (ret)
> +		of_platform_depopulate(dev);
> +
> +	return ret;
>  }
>  
>  static const char * const qup_clks[] = {
> -- 
> 2.50.1 (Apple Git-155)
> 

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

end of thread, other threads:[~2026-07-11 18:17 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:51 [PATCH] soc: qcom: geni: depopulate children on populate failure Pengpeng Hou
2026-07-11 18:17 ` Bjorn Andersson

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