All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/sti: hda: Fix bridge leak on component_add() failure
@ 2026-04-24 12:11 Myeonghun Pak
  2026-04-27 13:02 ` Luca Ceresoli
  0 siblings, 1 reply; 3+ messages in thread
From: Myeonghun Pak @ 2026-04-24 12:11 UTC (permalink / raw)
  To: Alain Volmat, Raphael Gallais-Pou
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel, Myeonghun Pak

sti_hda_probe() registers its bridge before adding the component. If
component_add() fails, probe returns the error directly and leaves the
bridge registered.

The remove callback unregisters the bridge, but remove is only called
after a successful probe. Remove the bridge locally when component_add()
fails so the probe error path matches the successful-probe remove path.

Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
 drivers/gpu/drm/sti/sti_hda.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index b739782788..9223135c93 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -741,6 +741,7 @@ static int sti_hda_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct sti_hda *hda;
 	struct resource *res;
+	int ret;
 
 	DRM_INFO("%s\n", __func__);
 
@@ -783,7 +784,11 @@ static int sti_hda_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, hda);
 
-	return component_add(&pdev->dev, &sti_hda_ops);
+	ret = component_add(&pdev->dev, &sti_hda_ops);
+	if (ret)
+		drm_bridge_remove(&hda->bridge);
+
+	return ret;
 }
 
 static void sti_hda_remove(struct platform_device *pdev)
-- 

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

* Re: [PATCH] drm/sti: hda: Fix bridge leak on component_add() failure
  2026-04-24 12:11 [PATCH] drm/sti: hda: Fix bridge leak on component_add() failure Myeonghun Pak
@ 2026-04-27 13:02 ` Luca Ceresoli
  2026-04-27 13:16   ` Myeonghun Pak
  0 siblings, 1 reply; 3+ messages in thread
From: Luca Ceresoli @ 2026-04-27 13:02 UTC (permalink / raw)
  To: Myeonghun Pak, Alain Volmat, Raphael Gallais-Pou
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel

Hello Myeonghun,

On Fri Apr 24, 2026 at 2:11 PM CEST, Myeonghun Pak wrote:
> sti_hda_probe() registers its bridge before adding the component. If
> component_add() fails, probe returns the error directly and leaves the
> bridge registered.
>
> The remove callback unregisters the bridge, but remove is only called
> after a successful probe. Remove the bridge locally when component_add()
> fails so the probe error path matches the successful-probe remove path.
>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>

Duplicate of [0]?

[0] https://lore.kernel.org/all/20260423200622.325076-1-osama.abdelkader@gmail.com/

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH] drm/sti: hda: Fix bridge leak on component_add() failure
  2026-04-27 13:02 ` Luca Ceresoli
@ 2026-04-27 13:16   ` Myeonghun Pak
  0 siblings, 0 replies; 3+ messages in thread
From: Myeonghun Pak @ 2026-04-27 13:16 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Alain Volmat, Raphael Gallais-Pou, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	dri-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

Hello Luca,

Yes, this is a duplicate. I missed Osama's patch when preparing mine.

Please ignore/drop my patch, and sorry for the noise.

Thanks,
Myeonghun

2026년 4월 27일 (월) 오후 10:02, Luca Ceresoli <luca.ceresoli@bootlin.com>님이 작성:

> Hello Myeonghun,
>
> On Fri Apr 24, 2026 at 2:11 PM CEST, Myeonghun Pak wrote:
> > sti_hda_probe() registers its bridge before adding the component. If
> > component_add() fails, probe returns the error directly and leaves the
> > bridge registered.
> >
> > The remove callback unregisters the bridge, but remove is only called
> > after a successful probe. Remove the bridge locally when component_add()
> > fails so the probe error path matches the successful-probe remove path.
> >
> > Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
>
> Duplicate of [0]?
>
> [0]
> https://lore.kernel.org/all/20260423200622.325076-1-osama.abdelkader@gmail.com/
>
> Luca
>
> --
> Luca Ceresoli, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>

[-- Attachment #2: Type: text/html, Size: 1699 bytes --]

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

end of thread, other threads:[~2026-04-27 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-24 12:11 [PATCH] drm/sti: hda: Fix bridge leak on component_add() failure Myeonghun Pak
2026-04-27 13:02 ` Luca Ceresoli
2026-04-27 13:16   ` Myeonghun Pak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.