mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] bus: qcom-ebi2: Fix clock leak on probe failure
@ 2026-06-20  8:04 Ruoyu Wang
  2026-06-22  9:15 ` Konrad Dybcio
  2026-07-08 14:56 ` Bjorn Andersson
  0 siblings, 2 replies; 4+ messages in thread
From: Ruoyu Wang @ 2026-06-20  8:04 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio
  Cc: Linus Walleij, linux-arm-msm, linux-kernel, Ruoyu Wang

qcom_ebi2_probe() enables the EBI2X and EBI2 clocks before it walks
child nodes and populates child devices. If reading a child node's reg
property fails, or if of_platform_default_populate() fails, probe returns
without disabling either clock.

Route those failure paths through the existing clock cleanup labels so a
failed probe does not leave the clocks prepared and enabled.

Fixes: 335a12754808 ("bus: qcom: add EBI2 driver")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
This is a minimal error-path fix for a previously reported leak. A broader
devm_clk_get_enabled() conversion was posted in 2023 and reviewed, and a
similar cleanup was posted in 2024, but neither appears in current upstream:
https://lkml.iu.edu/hypermail/linux/kernel/2305.1/00605.html
https://lkml.iu.edu/2408.2/09536.html

 drivers/bus/qcom-ebi2.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/qcom-ebi2.c b/drivers/bus/qcom-ebi2.c
index be8166565e7c..ab00c75b9e95 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,12 @@ 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)
+			goto err_disable_clk;
+	}
+
 	return 0;
 
 err_disable_clk:
-- 
git 2.51.0

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

* Re: [PATCH] bus: qcom-ebi2: Fix clock leak on probe failure
  2026-06-20  8:04 [PATCH] bus: qcom-ebi2: Fix clock leak on probe failure Ruoyu Wang
@ 2026-06-22  9:15 ` Konrad Dybcio
  2026-06-22 12:40   ` Linus Walleij
  2026-07-08 14:56 ` Bjorn Andersson
  1 sibling, 1 reply; 4+ messages in thread
From: Konrad Dybcio @ 2026-06-22  9:15 UTC (permalink / raw)
  To: Ruoyu Wang, Bjorn Andersson, Konrad Dybcio
  Cc: Linus Walleij, linux-arm-msm, linux-kernel

On 6/20/26 10:04 AM, Ruoyu Wang wrote:
> qcom_ebi2_probe() enables the EBI2X and EBI2 clocks before it walks
> child nodes and populates child devices. If reading a child node's reg
> property fails, or if of_platform_default_populate() fails, probe returns
> without disabling either clock.
> 
> Route those failure paths through the existing clock cleanup labels so a
> failed probe does not leave the clocks prepared and enabled.
> 
> Fixes: 335a12754808 ("bus: qcom: add EBI2 driver")
> Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
> ---
> This is a minimal error-path fix for a previously reported leak. A broader
> devm_clk_get_enabled() conversion was posted in 2023 and reviewed, and a
> similar cleanup was posted in 2024, but neither appears in current upstream:
> https://lkml.iu.edu/hypermail/linux/kernel/2305.1/00605.html
> https://lkml.iu.edu/2408.2/09536.html

Someone raised an identical patch last week

https://lore.kernel.org/linux-arm-msm/d1882207-4756-4e65-ba30-b47ccc821fd4@oss.qualcomm.com/

Konrad


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

* Re: [PATCH] bus: qcom-ebi2: Fix clock leak on probe failure
  2026-06-22  9:15 ` Konrad Dybcio
@ 2026-06-22 12:40   ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2026-06-22 12:40 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Ruoyu Wang, Bjorn Andersson, Konrad Dybcio, Linus Walleij,
	linux-arm-msm, linux-kernel

On Mon, Jun 22, 2026 at 11:15 AM Konrad Dybcio
<konrad.dybcio@oss.qualcomm.com> wrote:
> On 6/20/26 10:04 AM, Ruoyu Wang wrote:
> > qcom_ebi2_probe() enables the EBI2X and EBI2 clocks before it walks
> > child nodes and populates child devices. If reading a child node's reg
> > property fails, or if of_platform_default_populate() fails, probe returns
> > without disabling either clock.
> >
> > Route those failure paths through the existing clock cleanup labels so a
> > failed probe does not leave the clocks prepared and enabled.
> >
> > Fixes: 335a12754808 ("bus: qcom: add EBI2 driver")
> > Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
> > ---
> > This is a minimal error-path fix for a previously reported leak. A broader
> > devm_clk_get_enabled() conversion was posted in 2023 and reviewed, and a
> > similar cleanup was posted in 2024, but neither appears in current upstream:
> > https://lkml.iu.edu/hypermail/linux/kernel/2305.1/00605.html
> > https://lkml.iu.edu/2408.2/09536.html
>
> Someone raised an identical patch last week
>
> https://lore.kernel.org/linux-arm-msm/d1882207-4756-4e65-ba30-b47ccc821fd4@oss.qualcomm.com/

...in an obscure and seldom used driver.

So a clear sign that these reporters are using the same AI agent
to find random bugs ;D

Yours,
Linus Walleij

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

* Re: [PATCH] bus: qcom-ebi2: Fix clock leak on probe failure
  2026-06-20  8:04 [PATCH] bus: qcom-ebi2: Fix clock leak on probe failure Ruoyu Wang
  2026-06-22  9:15 ` Konrad Dybcio
@ 2026-07-08 14:56 ` Bjorn Andersson
  1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2026-07-08 14:56 UTC (permalink / raw)
  To: Konrad Dybcio, Ruoyu Wang; +Cc: linux-arm-msm, linux-kernel, Linus Walleij


On Sat, 20 Jun 2026 16:04:06 +0800, Ruoyu Wang wrote:
> qcom_ebi2_probe() enables the EBI2X and EBI2 clocks before it walks
> child nodes and populates child devices. If reading a child node's reg
> property fails, or if of_platform_default_populate() fails, probe returns
> without disabling either clock.
> 
> Route those failure paths through the existing clock cleanup labels so a
> failed probe does not leave the clocks prepared and enabled.
> 
> [...]

Applied, thanks!

[1/1] bus: qcom-ebi2: Fix clock leak on probe failure
      commit: 64774dea58969194ea5c27fa639954e551a87024

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>

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

end of thread, other threads:[~2026-07-08 14:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-20  8:04 [PATCH] bus: qcom-ebi2: Fix clock leak on probe failure Ruoyu Wang
2026-06-22  9:15 ` Konrad Dybcio
2026-06-22 12:40   ` Linus Walleij
2026-07-08 14:56 ` Bjorn Andersson

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®