public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 2/2] drm/bridge: chipone-icn6211: use devm_drm_bridge_add in dsi probe
@ 2026-04-23 20:06 Osama Abdelkader
  2026-04-29 11:39 ` Luca Ceresoli
  2026-04-30 11:01 ` Luca Ceresoli
  0 siblings, 2 replies; 4+ messages in thread
From: Osama Abdelkader @ 2026-04-23 20:06 UTC (permalink / raw)
  To: luca.ceresoli, Jagan Teki, Andrzej Hajda, Neil Armstrong,
	Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel
  Cc: Osama Abdelkader

Use devm_drm_bridge_add() so the bridge is released if probe fails after
registration, and drop drm_bridge_remove() in chipone_dsi_probe.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
---
v3: split the patch into two, one for i2c probe (bugfix) and one for dsi probe
v2: devm_drm_bridge_add instead of drm_bridge_add
---
 drivers/gpu/drm/bridge/chipone-icn6211.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c
index 4d76e1bd5e78..f53e64129ebe 100644
--- a/drivers/gpu/drm/bridge/chipone-icn6211.c
+++ b/drivers/gpu/drm/bridge/chipone-icn6211.c
@@ -730,13 +730,11 @@ static int chipone_dsi_probe(struct mipi_dsi_device *dsi)
 
 	mipi_dsi_set_drvdata(dsi, icn);
 
-	drm_bridge_add(&icn->bridge);
-
-	ret = chipone_dsi_attach(icn);
+	ret = devm_drm_bridge_add(dev, &icn->bridge);
 	if (ret)
-		drm_bridge_remove(&icn->bridge);
+		return ret;
 
-	return ret;
+	return chipone_dsi_attach(icn);
 }
 
 static int chipone_i2c_probe(struct i2c_client *client)
-- 
2.43.0


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

* Re: [PATCH v3 2/2] drm/bridge: chipone-icn6211: use devm_drm_bridge_add in dsi probe
  2026-04-23 20:06 [PATCH v3 2/2] drm/bridge: chipone-icn6211: use devm_drm_bridge_add in dsi probe Osama Abdelkader
@ 2026-04-29 11:39 ` Luca Ceresoli
  2026-04-30 11:01 ` Luca Ceresoli
  1 sibling, 0 replies; 4+ messages in thread
From: Luca Ceresoli @ 2026-04-29 11:39 UTC (permalink / raw)
  To: Osama Abdelkader, Jagan Teki, Andrzej Hajda, Neil Armstrong,
	Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel

On Thu Apr 23, 2026 at 10:06 PM CEST, Osama Abdelkader wrote:
> Use devm_drm_bridge_add() so the bridge is released if probe fails after
> registration, and drop drm_bridge_remove() in chipone_dsi_probe.
>
> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> ---
> v3: split the patch into two, one for i2c probe (bugfix) and one for dsi probe
> v2: devm_drm_bridge_add instead of drm_bridge_add

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

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

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

* Re: [PATCH v3 2/2] drm/bridge: chipone-icn6211: use devm_drm_bridge_add in dsi probe
  2026-04-23 20:06 [PATCH v3 2/2] drm/bridge: chipone-icn6211: use devm_drm_bridge_add in dsi probe Osama Abdelkader
  2026-04-29 11:39 ` Luca Ceresoli
@ 2026-04-30 11:01 ` Luca Ceresoli
  2026-04-30 20:03   ` Osama Abdelkader
  1 sibling, 1 reply; 4+ messages in thread
From: Luca Ceresoli @ 2026-04-30 11:01 UTC (permalink / raw)
  To: Osama Abdelkader, Jagan Teki, Andrzej Hajda, Neil Armstrong,
	Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel

Hello Osama,

On Thu Apr 23, 2026 at 10:06 PM CEST, Osama Abdelkader wrote:
> Use devm_drm_bridge_add() so the bridge is released if probe fails after
> registration, and drop drm_bridge_remove() in chipone_dsi_probe.

Wait, this patch must drop drm_bridge_remove() in chipone_dsi_remove() too!
Otherwise it'd be introducing an excess put, and consequent use-after-free.

I have to withdraw my R-by.

You can amend in v4.

Luca

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

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

* Re: [PATCH v3 2/2] drm/bridge: chipone-icn6211: use devm_drm_bridge_add in dsi probe
  2026-04-30 11:01 ` Luca Ceresoli
@ 2026-04-30 20:03   ` Osama Abdelkader
  0 siblings, 0 replies; 4+ messages in thread
From: Osama Abdelkader @ 2026-04-30 20:03 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Jagan Teki, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel

Hello Luca,

On Thu, Apr 30, 2026 at 01:01:16PM +0200, Luca Ceresoli wrote:
> Hello Osama,
> 
> On Thu Apr 23, 2026 at 10:06 PM CEST, Osama Abdelkader wrote:
> > Use devm_drm_bridge_add() so the bridge is released if probe fails after
> > registration, and drop drm_bridge_remove() in chipone_dsi_probe.
> 
> Wait, this patch must drop drm_bridge_remove() in chipone_dsi_remove() too!
> Otherwise it'd be introducing an excess put, and consequent use-after-free.
> 
> I have to withdraw my R-by.
> 
> You can amend in v4.
> 

Good catch, added now in v4.

Thanks,
Osama

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

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

end of thread, other threads:[~2026-04-30 20:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 20:06 [PATCH v3 2/2] drm/bridge: chipone-icn6211: use devm_drm_bridge_add in dsi probe Osama Abdelkader
2026-04-29 11:39 ` Luca Ceresoli
2026-04-30 11:01 ` Luca Ceresoli
2026-04-30 20:03   ` Osama Abdelkader

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