All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels
@ 2026-08-12 13:04 Osama Abdelkader
  2026-08-12 13:04 ` [PATCH v3 2/6] drm/panel: Use devm_mipi_dsi_attach in Samsung panels Osama Abdelkader
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Osama Abdelkader @ 2026-08-12 13:04 UTC (permalink / raw)
  To: luca.ceresoli, Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Jerry Han, dri-devel, linux-kernel
  Cc: Osama Abdelkader

Use the managed MIPI DSI attach helper in BOE panel drivers and drop the
corresponding manual detach calls from remove paths.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>

---
v3:
- Move the changelog after the `---`.

v2:
- break long description lines.
- add Signed-off-by tag

 drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c       | 8 +-------
 drivers/gpu/drm/panel/panel-boe-himax8279d.c         | 8 +-------
 drivers/gpu/drm/panel/panel-boe-td4320.c             | 8 +-------
 drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c | 4 +---
 drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c       | 8 +-------
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c       | 7 +------
 6 files changed, 6 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
index 84c21c62a43e..6a74523a6614 100644
--- a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
+++ b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
@@ -359,7 +359,7 @@ static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&boe->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		return ret;
@@ -371,12 +371,6 @@ static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi)
 static void boe_bf060y8m_aj0_remove(struct mipi_dsi_device *dsi)
 {
 	struct boe_bf060y8m_aj0 *boe = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&boe->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index 4a8560b4b899..ffcb63f65b75 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -881,7 +881,7 @@ static int panel_probe(struct mipi_dsi_device *dsi)
 	if (err < 0)
 		return err;
 
-	err = mipi_dsi_attach(dsi);
+	err = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (err < 0)
 		drm_panel_remove(&pinfo->base);
 
@@ -891,12 +891,6 @@ static int panel_probe(struct mipi_dsi_device *dsi)
 static void panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi);
-	int err;
-
-	err = mipi_dsi_detach(dsi);
-	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
-
 	drm_panel_remove(&pinfo->base);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-boe-td4320.c b/drivers/gpu/drm/panel/panel-boe-td4320.c
index 23558a76dd72..704d5a9c13e7 100644
--- a/drivers/gpu/drm/panel/panel-boe-td4320.c
+++ b/drivers/gpu/drm/panel/panel-boe-td4320.c
@@ -204,7 +204,7 @@ static int boe_td4320_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		drm_panel_remove(&ctx->panel);
 		return dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
@@ -216,12 +216,6 @@ static int boe_td4320_probe(struct mipi_dsi_device *dsi)
 static void boe_td4320_remove(struct mipi_dsi_device *dsi)
 {
 	struct boe_td4320 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
index a70a2e58f88c..94cc675973e6 100644
--- a/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
+++ b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
@@ -393,7 +393,7 @@ static int boe_th101mb31ig002_dsi_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err_probe(&dsi->dev, ret,
 			      "Failed to attach panel to DSI host\n");
@@ -407,8 +407,6 @@ static int boe_th101mb31ig002_dsi_probe(struct mipi_dsi_device *dsi)
 static void boe_th101mb31ig002_dsi_remove(struct mipi_dsi_device *dsi)
 {
 	struct boe_th101mb31ig002 *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c
index 20b6e11a7d84..2ab7764d4094 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c
@@ -200,7 +200,7 @@ static int boe_tv101wum_ll2_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		drm_panel_remove(&ctx->panel);
 		return dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
@@ -212,12 +212,6 @@ static int boe_tv101wum_ll2_probe(struct mipi_dsi_device *dsi)
 static void boe_tv101wum_ll2_remove(struct mipi_dsi_device *dsi)
 {
 	struct boe_tv101wum_ll2 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index 150dff3ab6c3..7d2672578dd8 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1765,7 +1765,7 @@ static int boe_panel_probe(struct mipi_dsi_device *dsi)
 
 	mipi_dsi_set_drvdata(dsi, boe);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret)
 		drm_panel_remove(&boe->base);
 
@@ -1775,11 +1775,6 @@ static int boe_panel_probe(struct mipi_dsi_device *dsi)
 static void boe_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct boe_panel *boe = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
 
 	if (boe->base.dev)
 		drm_panel_remove(&boe->base);
-- 
2.43.0


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

* [PATCH v3 2/6] drm/panel: Use devm_mipi_dsi_attach in Samsung panels
  2026-08-12 13:04 [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels Osama Abdelkader
@ 2026-08-12 13:04 ` Osama Abdelkader
  2026-08-12 13:04 ` [PATCH v3 3/6] drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels Osama Abdelkader
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Osama Abdelkader @ 2026-08-12 13:04 UTC (permalink / raw)
  To: luca.ceresoli, Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Artur Weber, David Heidelberg, Dzmitry Sankouski, Yedaya Katsman,
	Casey Connolly, dri-devel, linux-kernel
  Cc: Osama Abdelkader

Use the managed MIPI DSI attach helper in Samsung panel drivers and drop
the corresponding manual detach calls from remove paths.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>

---
v3:
- Move the changelog after the `---`.

v2:
- break long description lines.
- add Signed-off-by tag

 drivers/gpu/drm/panel/panel-samsung-s6d16d0.c            | 4 +---
 drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c            | 8 +-------
 drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c            | 8 +-------
 drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c         | 8 +-------
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c            | 4 +---
 drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c            | 8 +-------
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c         | 4 +---
 drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c        | 3 +--
 drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c | 8 +-------
 drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c | 8 +-------
 drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c            | 4 +---
 drivers/gpu/drm/panel/panel-samsung-s6e8fc0-m1906f9.c    | 8 +-------
 drivers/gpu/drm/panel/panel-samsung-sofef00.c            | 8 +-------
 13 files changed, 13 insertions(+), 70 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
index 54a65abf7e89..8b6d39636f50 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
@@ -209,7 +209,7 @@ static int s6d16d0_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&s6->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0)
 		drm_panel_remove(&s6->panel);
 
@@ -219,8 +219,6 @@ static int s6d16d0_probe(struct mipi_dsi_device *dsi)
 static void s6d16d0_remove(struct mipi_dsi_device *dsi)
 {
 	struct s6d16d0 *s6 = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&s6->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
index 692020081524..1f070a99521a 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
@@ -438,7 +438,7 @@ static int s6d7aa0_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -451,12 +451,6 @@ static int s6d7aa0_probe(struct mipi_dsi_device *dsi)
 static void s6d7aa0_remove(struct mipi_dsi_device *dsi)
 {
 	struct s6d7aa0 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c b/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
index f4d75eca3cdf..88e4d59941b4 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
@@ -213,7 +213,7 @@ static int s6e3fa7_panel_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -226,12 +226,6 @@ static int s6e3fa7_panel_probe(struct mipi_dsi_device *dsi)
 static void s6e3fa7_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct s6e3fa7_panel *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c b/drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c
index e63080204af7..cba46e3915b8 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c
@@ -342,7 +342,7 @@ static int s6e3fc2x01_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -355,12 +355,6 @@ static int s6e3fc2x01_probe(struct mipi_dsi_device *dsi)
 static void s6e3fc2x01_remove(struct mipi_dsi_device *dsi)
 {
 	struct samsung_s6e3fc2x01 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
index 1db0c63b1131..a1808124278b 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
@@ -737,7 +737,7 @@ static int s6e3ha2_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0)
 		goto remove_panel;
 
@@ -753,8 +753,6 @@ static int s6e3ha2_probe(struct mipi_dsi_device *dsi)
 static void s6e3ha2_remove(struct mipi_dsi_device *dsi)
 {
 	struct s6e3ha2 *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 	backlight_device_unregister(ctx->bl_dev);
 }
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c
index 550e9ef9bb71..22be3463357c 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c
@@ -299,7 +299,7 @@ static int s6e3ha8_amb577px01_wqhd_probe(struct mipi_dsi_device *dsi)
 	priv->dsc.bits_per_pixel = 8 << 4; /* 4 fractional bits */
 	priv->dsc.block_pred_enable = true;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&priv->panel);
@@ -312,12 +312,6 @@ static int s6e3ha8_amb577px01_wqhd_probe(struct mipi_dsi_device *dsi)
 static void s6e3ha8_amb577px01_wqhd_remove(struct mipi_dsi_device *dsi)
 {
 	struct s6e3ha8 *priv = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&priv->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
index e05199ce14ee..4b16ffe31b8f 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
@@ -477,7 +477,7 @@ static int s6e63j0x03_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0)
 		goto remove_panel;
 
@@ -493,8 +493,6 @@ static int s6e63j0x03_probe(struct mipi_dsi_device *dsi)
 static void s6e63j0x03_remove(struct mipi_dsi_device *dsi)
 {
 	struct s6e63j0x03 *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 
 	backlight_device_unregister(ctx->bl_dev);
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c
index 2630975c111b..0edce6eedc0b 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c
@@ -105,7 +105,7 @@ static int s6e63m0_dsi_probe(struct mipi_dsi_device *dsi)
 	if (ret)
 		return ret;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0)
 		s6e63m0_remove(dev);
 
@@ -114,7 +114,6 @@ static int s6e63m0_dsi_probe(struct mipi_dsi_device *dsi)
 
 static void s6e63m0_dsi_remove(struct mipi_dsi_device *dsi)
 {
-	mipi_dsi_detach(dsi);
 	s6e63m0_remove(&dsi->dev);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c
index 77fee36dbb55..e9e621830fde 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams427ap24.c
@@ -724,7 +724,7 @@ static int s6e88a0_ams427ap24_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -737,12 +737,6 @@ static int s6e88a0_ams427ap24_probe(struct mipi_dsi_device *dsi)
 static void s6e88a0_ams427ap24_remove(struct mipi_dsi_device *dsi)
 {
 	struct s6e88a0_ams427ap24 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
index ca5cad41ff1d..43fd28cd1a53 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
@@ -196,7 +196,7 @@ static int s6e88a0_ams452ef01_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -209,12 +209,6 @@ static int s6e88a0_ams452ef01_probe(struct mipi_dsi_device *dsi)
 static void s6e88a0_ams452ef01_remove(struct mipi_dsi_device *dsi)
 {
 	struct s6e88a0_ams452ef01 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
index 1b5c500d4f4e..4902079edd27 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
@@ -1020,7 +1020,7 @@ static int s6e8aa0_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0)
 		drm_panel_remove(&ctx->panel);
 
@@ -1030,8 +1030,6 @@ static int s6e8aa0_probe(struct mipi_dsi_device *dsi)
 static void s6e8aa0_remove(struct mipi_dsi_device *dsi)
 {
 	struct s6e8aa0 *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8fc0-m1906f9.c b/drivers/gpu/drm/panel/panel-samsung-s6e8fc0-m1906f9.c
index 2fae0dc6c424..6c86cfaf92b2 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e8fc0-m1906f9.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e8fc0-m1906f9.c
@@ -258,7 +258,7 @@ static int s6e8fc0_m1906f9_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		drm_panel_remove(&ctx->panel);
 		return dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
@@ -270,12 +270,6 @@ static int s6e8fc0_m1906f9_probe(struct mipi_dsi_device *dsi)
 static void s6e8fc0_remove(struct mipi_dsi_device *dsi)
 {
 	struct s6e8fc0_ctx *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
index f07d6533ed69..5cb05ba246b8 100644
--- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c
+++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
@@ -252,7 +252,7 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -265,12 +265,6 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi)
 static void sofef00_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct sofef00_panel *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
-- 
2.43.0


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

* [PATCH v3 3/6] drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels
  2026-08-12 13:04 [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels Osama Abdelkader
  2026-08-12 13:04 ` [PATCH v3 2/6] drm/panel: Use devm_mipi_dsi_attach in Samsung panels Osama Abdelkader
@ 2026-08-12 13:04 ` Osama Abdelkader
  2026-08-12 13:16   ` sashiko-bot
  2026-08-12 13:04 ` [PATCH v3 4/6] drm/panel: Use devm_mipi_dsi_attach in Himax and Ilitek panels Osama Abdelkader
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Osama Abdelkader @ 2026-08-12 13:04 UTC (permalink / raw)
  To: luca.ceresoli, Linus Walleij, Neil Armstrong, Jessica Zhang,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Cristian Cozzolino, Sumit Semwal,
	Krzysztof Kozlowski, Robert Chiras, dri-devel, linux-kernel
  Cc: Osama Abdelkader

Use the managed MIPI DSI attach helper in Novatek and Raydium panel
drivers and drop the corresponding manual detach calls from remove paths.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>

---
v3:
- Move the changelog after the `---`.

v2:
- break long description lines.
- add Signed-off-by tag

 drivers/gpu/drm/panel/panel-novatek-nt35510.c  | 4 +---
 drivers/gpu/drm/panel/panel-novatek-nt35532.c  | 8 +-------
 drivers/gpu/drm/panel/panel-novatek-nt35560.c  | 4 +---
 drivers/gpu/drm/panel/panel-novatek-nt36672a.c | 8 +-------
 drivers/gpu/drm/panel/panel-novatek-nt36672e.c | 4 +---
 drivers/gpu/drm/panel/panel-novatek-nt37700f.c | 8 +-------
 drivers/gpu/drm/panel/panel-novatek-nt37801.c  | 8 +-------
 drivers/gpu/drm/panel/panel-raydium-rm67191.c  | 8 +-------
 drivers/gpu/drm/panel/panel-raydium-rm67200.c  | 8 +-------
 drivers/gpu/drm/panel/panel-raydium-rm68200.c  | 4 +---
 drivers/gpu/drm/panel/panel-raydium-rm692e5.c  | 8 +-------
 11 files changed, 11 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35510.c b/drivers/gpu/drm/panel/panel-novatek-nt35510.c
index 3189d89c7ca0..e75b6ac3df5c 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35510.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35510.c
@@ -1175,7 +1175,7 @@ static int nt35510_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&nt->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0)
 		drm_panel_remove(&nt->panel);
 
@@ -1186,8 +1186,6 @@ static void nt35510_remove(struct mipi_dsi_device *dsi)
 {
 	struct nt35510 *nt = mipi_dsi_get_drvdata(dsi);
 	int ret;
-
-	mipi_dsi_detach(dsi);
 	/* Power off */
 	ret = nt35510_power_off(nt);
 	if (ret)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35532.c b/drivers/gpu/drm/panel/panel-novatek-nt35532.c
index edea766a3c44..e0bba71e3ff8 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35532.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35532.c
@@ -754,7 +754,7 @@ static int nt35532_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		drm_panel_remove(&ctx->panel);
 		return dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
@@ -766,12 +766,6 @@ static int nt35532_probe(struct mipi_dsi_device *dsi)
 static void nt35532_remove(struct mipi_dsi_device *dsi)
 {
 	struct novatek_nt35532 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35560.c b/drivers/gpu/drm/panel/panel-novatek-nt35560.c
index 6e5173f98a22..1f7d5d670923 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35560.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35560.c
@@ -435,7 +435,7 @@ static int nt35560_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&nt->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		drm_panel_remove(&nt->panel);
 		return ret;
@@ -447,8 +447,6 @@ static int nt35560_probe(struct mipi_dsi_device *dsi)
 static void nt35560_remove(struct mipi_dsi_device *dsi)
 {
 	struct nt35560 *nt = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&nt->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
index 464d9ce47d87..66f33cc42d30 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
@@ -458,7 +458,7 @@ static int nt36672a_panel_probe(struct mipi_dsi_device *dsi)
 	if (err < 0)
 		return err;
 
-	err = mipi_dsi_attach(dsi);
+	err = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (err < 0) {
 		drm_panel_remove(&pinfo->base);
 		return err;
@@ -470,12 +470,6 @@ static int nt36672a_panel_probe(struct mipi_dsi_device *dsi)
 static void nt36672a_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct nt36672a_panel *pinfo = mipi_dsi_get_drvdata(dsi);
-	int err;
-
-	err = mipi_dsi_detach(dsi);
-	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
-
 	drm_panel_remove(&pinfo->base);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
index c5e00eb55722..6309ea17e5bc 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
@@ -563,7 +563,7 @@ static int nt36672e_panel_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		goto err_dsi_attach;
@@ -579,8 +579,6 @@ static int nt36672e_panel_probe(struct mipi_dsi_device *dsi)
 static void nt36672e_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct nt36672e_panel *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(ctx->dsi);
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37700f.c b/drivers/gpu/drm/panel/panel-novatek-nt37700f.c
index c221dd498fed..0c9be8f4628c 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt37700f.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt37700f.c
@@ -259,7 +259,7 @@ static int nt37700f_tianma_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		drm_panel_remove(&ctx->panel);
 		return dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
@@ -271,12 +271,6 @@ static int nt37700f_tianma_probe(struct mipi_dsi_device *dsi)
 static void nt37700f_tianma_remove(struct mipi_dsi_device *dsi)
 {
 	struct nt37700f_tianma *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37801.c b/drivers/gpu/drm/panel/panel-novatek-nt37801.c
index 5e46c4c6d771..8430f70f0e28 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt37801.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt37801.c
@@ -283,7 +283,7 @@ static int novatek_nt37801_probe(struct mipi_dsi_device *dsi)
 	ctx->dsc.bits_per_pixel = 8 << 4; /* 4 fractional bits */
 	ctx->dsc.block_pred_enable = true;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		drm_panel_remove(&ctx->panel);
 		return dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
@@ -295,12 +295,6 @@ static int novatek_nt37801_probe(struct mipi_dsi_device *dsi)
 static void novatek_nt37801_remove(struct mipi_dsi_device *dsi)
 {
 	struct novatek_nt37801 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
index 2af6aa47a551..9bd2d94b03d9 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
@@ -592,7 +592,7 @@ static int rad_panel_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&panel->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret)
 		drm_panel_remove(&panel->panel);
 
@@ -602,12 +602,6 @@ static int rad_panel_probe(struct mipi_dsi_device *dsi)
 static void rad_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct rad_panel *rad = mipi_dsi_get_drvdata(dsi);
-	struct device *dev = &dsi->dev;
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret)
-		dev_err(dev, "Failed to detach from host (%d)\n", ret);
 
 	drm_panel_remove(&rad->panel);
 }
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67200.c b/drivers/gpu/drm/panel/panel-raydium-rm67200.c
index b2ba006c06f6..ff896e87fc51 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm67200.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm67200.c
@@ -422,7 +422,7 @@ static int raydium_rm67200_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -434,12 +434,6 @@ static int raydium_rm67200_probe(struct mipi_dsi_device *dsi)
 static void raydium_rm67200_remove(struct mipi_dsi_device *dsi)
 {
 	struct raydium_rm67200 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
index c535dc931903..e42936b4ae96 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
@@ -362,7 +362,7 @@ static int rm68200_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "mipi_dsi_attach() failed: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -375,8 +375,6 @@ static int rm68200_probe(struct mipi_dsi_device *dsi)
 static void rm68200_remove(struct mipi_dsi_device *dsi)
 {
 	struct rm68200 *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm692e5.c b/drivers/gpu/drm/panel/panel-raydium-rm692e5.c
index 8e9484768657..7cf284878178 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm692e5.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm692e5.c
@@ -331,7 +331,7 @@ static int rm692e5_probe(struct mipi_dsi_device *dsi)
 	ctx->dsc.bits_per_pixel = 8 << 4; /* 4 fractional bits */
 	ctx->dsc.block_pred_enable = true;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -344,12 +344,6 @@ static int rm692e5_probe(struct mipi_dsi_device *dsi)
 static void rm692e5_remove(struct mipi_dsi_device *dsi)
 {
 	struct rm692e5_panel *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
-- 
2.43.0


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

* [PATCH v3 4/6] drm/panel: Use devm_mipi_dsi_attach in Himax and Ilitek panels
  2026-08-12 13:04 [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels Osama Abdelkader
  2026-08-12 13:04 ` [PATCH v3 2/6] drm/panel: Use devm_mipi_dsi_attach in Samsung panels Osama Abdelkader
  2026-08-12 13:04 ` [PATCH v3 3/6] drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels Osama Abdelkader
@ 2026-08-12 13:04 ` Osama Abdelkader
  2026-08-12 13:13   ` sashiko-bot
  2026-08-12 13:04 ` [PATCH v3 5/6] drm/panel: Use devm_mipi_dsi_attach in display vendor panels Osama Abdelkader
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Osama Abdelkader @ 2026-08-12 13:04 UTC (permalink / raw)
  To: luca.ceresoli, Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Ondrej Jirman, Javier Martinez Canillas, Michael Trimarchi,
	Michael Walle, Dario Binacchi, dri-devel, linux-kernel
  Cc: Osama Abdelkader

Use the managed MIPI DSI attach helper in Himax and Ilitek panel drivers
and drop the corresponding manual detach calls from remove paths.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>

---
v3:
- Move the changelog after the `---`.

v2:
- break long description lines.
- add Signed-off-by tag

 drivers/gpu/drm/panel/panel-himax-hx83102.c       | 7 +------
 drivers/gpu/drm/panel/panel-himax-hx83112a.c      | 8 +-------
 drivers/gpu/drm/panel/panel-himax-hx83112b.c      | 8 +-------
 drivers/gpu/drm/panel/panel-himax-hx8394.c        | 8 +-------
 drivers/gpu/drm/panel/panel-ilitek-ili9805.c      | 9 +--------
 drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c | 3 +--
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c     | 4 +---
 drivers/gpu/drm/panel/panel-ilitek-ili9882t.c     | 7 +------
 8 files changed, 8 insertions(+), 46 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-himax-hx83102.c b/drivers/gpu/drm/panel/panel-himax-hx83102.c
index 6a0851ccf9bb..4a28541891a6 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83102.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83102.c
@@ -1318,7 +1318,7 @@ static int hx83102_probe(struct mipi_dsi_device *dsi)
 
 	mipi_dsi_set_drvdata(dsi, ctx);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret)
 		drm_panel_remove(&ctx->base);
 
@@ -1328,11 +1328,6 @@ static int hx83102_probe(struct mipi_dsi_device *dsi)
 static void hx83102_remove(struct mipi_dsi_device *dsi)
 {
 	struct hx83102 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
 
 	if (ctx->base.dev)
 		drm_panel_remove(&ctx->base);
diff --git a/drivers/gpu/drm/panel/panel-himax-hx83112a.c b/drivers/gpu/drm/panel/panel-himax-hx83112a.c
index 142cb1cc067a..bcd665b7ff88 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83112a.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83112a.c
@@ -305,7 +305,7 @@ static int hx83112a_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
 		drm_panel_remove(&ctx->panel);
@@ -318,12 +318,6 @@ static int hx83112a_probe(struct mipi_dsi_device *dsi)
 static void hx83112a_remove(struct mipi_dsi_device *dsi)
 {
 	struct hx83112a_panel *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-himax-hx83112b.c b/drivers/gpu/drm/panel/panel-himax-hx83112b.c
index 41f21f8c1373..1ea5a9dc3ac5 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83112b.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83112b.c
@@ -388,7 +388,7 @@ static int hx83112b_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		drm_panel_remove(&ctx->panel);
 		return dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
@@ -400,12 +400,6 @@ static int hx83112b_probe(struct mipi_dsi_device *dsi)
 static void hx83112b_remove(struct mipi_dsi_device *dsi)
 {
 	struct hx83112b_panel *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-himax-hx8394.c b/drivers/gpu/drm/panel/panel-himax-hx8394.c
index 09124610fdc8..7fc7063862c0 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx8394.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx8394.c
@@ -1025,7 +1025,7 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err_probe(dev, ret, "mipi_dsi_attach failed\n");
 		drm_panel_remove(&ctx->panel);
@@ -1043,12 +1043,6 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)
 static void hx8394_remove(struct mipi_dsi_device *dsi)
 {
 	struct hx8394 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9805.c b/drivers/gpu/drm/panel/panel-ilitek-ili9805.c
index 5610a225f77b..aadb13eb41e0 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9805.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9805.c
@@ -307,7 +307,7 @@ static int ili9805_dsi_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(&dsi->dev, "mipi_dsi_attach failed: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -320,13 +320,6 @@ static int ili9805_dsi_probe(struct mipi_dsi_device *dsi)
 static void ili9805_dsi_remove(struct mipi_dsi_device *dsi)
 {
 	struct ili9805 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n",
-			ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
index 0fb06c425545..a03a1b4411ad 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
@@ -141,7 +141,7 @@ static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi)
 	if (ret)
 		return ret;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
 		ili9806e_remove(dev);
@@ -153,7 +153,6 @@ static int ili9806e_dsi_probe(struct mipi_dsi_device *dsi)
 
 static void ili9806e_dsi_remove(struct mipi_dsi_device *dsi)
 {
-	mipi_dsi_detach(dsi);
 	ili9806e_remove(&dsi->dev);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 3abdd0870e83..ca7037a4242c 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -2597,14 +2597,12 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
 	dsi->format = MIPI_DSI_FMT_RGB888;
 	dsi->lanes = ctx->desc->lanes;
 
-	return mipi_dsi_attach(dsi);
+	return devm_mipi_dsi_attach(&dsi->dev, dsi);
 }
 
 static void ili9881c_dsi_remove(struct mipi_dsi_device *dsi)
 {
 	struct ili9881c *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
index 6d07fe901357..896de9460aa8 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9882t.c
@@ -844,7 +844,7 @@ static int ili9882t_probe(struct mipi_dsi_device *dsi)
 
 	mipi_dsi_set_drvdata(dsi, ili);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret)
 		drm_panel_remove(&ili->base);
 
@@ -854,11 +854,6 @@ static int ili9882t_probe(struct mipi_dsi_device *dsi)
 static void ili9882t_remove(struct mipi_dsi_device *dsi)
 {
 	struct ili9882t *ili = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
 
 	if (ili->base.dev)
 		drm_panel_remove(&ili->base);
-- 
2.43.0


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

* [PATCH v3 5/6] drm/panel: Use devm_mipi_dsi_attach in display vendor panels
  2026-08-12 13:04 [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels Osama Abdelkader
                   ` (2 preceding siblings ...)
  2026-08-12 13:04 ` [PATCH v3 4/6] drm/panel: Use devm_mipi_dsi_attach in Himax and Ilitek panels Osama Abdelkader
@ 2026-08-12 13:04 ` Osama Abdelkader
  2026-08-12 13:12   ` sashiko-bot
  2026-08-12 13:04 ` [PATCH v3 6/6] drm/panel: Use devm_mipi_dsi_attach in assorted panels Osama Abdelkader
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Osama Abdelkader @ 2026-08-12 13:04 UTC (permalink / raw)
  To: luca.ceresoli, Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	dri-devel, linux-kernel
  Cc: Osama Abdelkader

Use the managed MIPI DSI attach helper in JDI, Sharp, Sony, Visionox and
Leadtek panel drivers and drop the corresponding manual detach calls from
remove paths.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>

---
v3:
- Move the changelog after the `---`.

v2:
- break long description lines.
- add Signed-off-by tag

 drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c           | 8 +-------
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c         | 8 +-------
 drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c     | 8 +-------
 drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c     | 8 +-------
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c        | 7 +------
 drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c        | 8 +-------
 drivers/gpu/drm/panel/panel-sony-td4353-jdi.c          | 8 +-------
 drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c | 8 +-------
 drivers/gpu/drm/panel/panel-visionox-r66451.c          | 8 +-------
 drivers/gpu/drm/panel/panel-visionox-rm69299.c         | 4 +---
 10 files changed, 10 insertions(+), 65 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
index cbe354b51bce..ce299160d3ab 100644
--- a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
+++ b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
@@ -202,7 +202,7 @@ static int jdi_fhd_r63452_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		return ret;
@@ -214,12 +214,6 @@ static int jdi_fhd_r63452_probe(struct mipi_dsi_device *dsi)
 static void jdi_fhd_r63452_remove(struct mipi_dsi_device *dsi)
 {
 	struct jdi_fhd_r63452 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
index 01bd748aecec..d9cba45eb729 100644
--- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -380,7 +380,7 @@ static int jdi_panel_probe(struct mipi_dsi_device *dsi)
 	if (ret < 0)
 		return ret;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		jdi_panel_del(jdi);
 		return ret;
@@ -392,12 +392,6 @@ static int jdi_panel_probe(struct mipi_dsi_device *dsi)
 static void jdi_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct jdi_panel *jdi = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n",
-			ret);
 
 	jdi_panel_del(jdi);
 }
diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
index 0856df5a6ee2..b660d7055810 100644
--- a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
+++ b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
@@ -585,7 +585,7 @@ static int ltk050h3146w_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "mipi_dsi_attach failed: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -598,12 +598,6 @@ static int ltk050h3146w_probe(struct mipi_dsi_device *dsi)
 static void ltk050h3146w_remove(struct mipi_dsi_device *dsi)
 {
 	struct ltk050h3146w *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
index 7f19fd5b8060..6ec6f81877aa 100644
--- a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
+++ b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
@@ -651,7 +651,7 @@ static int ltk500hd1829_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "mipi_dsi_attach failed: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -664,12 +664,6 @@ static int ltk500hd1829_probe(struct mipi_dsi_device *dsi)
 static void ltk500hd1829_remove(struct mipi_dsi_device *dsi)
 {
 	struct ltk500hd1829 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
index 989b030ea22d..11615551e8a6 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
@@ -244,7 +244,7 @@ static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi)
 	if (ret < 0)
 		return ret;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		sharp_nt_panel_del(sharp_nt);
 		return ret;
@@ -256,11 +256,6 @@ static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi)
 static void sharp_nt_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
 
 	sharp_nt_panel_del(sharp_nt);
 }
diff --git a/drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c b/drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c
index 0456f3d705e7..236d45121a44 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls060t1sx01.c
@@ -235,7 +235,7 @@ static int sharp_ls060_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -248,12 +248,6 @@ static int sharp_ls060_probe(struct mipi_dsi_device *dsi)
 static void sharp_ls060_remove(struct mipi_dsi_device *dsi)
 {
 	struct sharp_ls060 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-sony-td4353-jdi.c b/drivers/gpu/drm/panel/panel-sony-td4353-jdi.c
index a14c86c60d19..08e4adf9e0f0 100644
--- a/drivers/gpu/drm/panel/panel-sony-td4353-jdi.c
+++ b/drivers/gpu/drm/panel/panel-sony-td4353-jdi.c
@@ -216,7 +216,7 @@ static int sony_td4353_jdi_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -229,12 +229,6 @@ static int sony_td4353_jdi_probe(struct mipi_dsi_device *dsi)
 static void sony_td4353_jdi_remove(struct mipi_dsi_device *dsi)
 {
 	struct sony_td4353_jdi *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c b/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c
index 216a6ad8696e..5ce8b1cdf024 100644
--- a/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c
+++ b/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c
@@ -474,7 +474,7 @@ static int truly_nt35521_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -487,12 +487,6 @@ static int truly_nt35521_probe(struct mipi_dsi_device *dsi)
 static void truly_nt35521_remove(struct mipi_dsi_device *dsi)
 {
 	struct truly_nt35521 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-visionox-r66451.c b/drivers/gpu/drm/panel/panel-visionox-r66451.c
index 690cccedd438..40bbc3ea6958 100644
--- a/drivers/gpu/drm/panel/panel-visionox-r66451.c
+++ b/drivers/gpu/drm/panel/panel-visionox-r66451.c
@@ -306,7 +306,7 @@ static int visionox_r66451_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -318,12 +318,6 @@ static int visionox_r66451_probe(struct mipi_dsi_device *dsi)
 static void visionox_r66451_remove(struct mipi_dsi_device *dsi)
 {
 	struct visionox_r66451 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
index 50f8a84537ca..7a60b1d436df 100644
--- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c
+++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
@@ -388,7 +388,7 @@ static int visionox_rm69299_probe(struct mipi_dsi_device *dsi)
 	dsi->format = MIPI_DSI_FMT_RGB888;
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM |
 			  MIPI_DSI_CLOCK_NON_CONTINUOUS;
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "dsi attach failed ret = %d\n", ret);
 		goto err_dsi_attach;
@@ -404,8 +404,6 @@ static int visionox_rm69299_probe(struct mipi_dsi_device *dsi)
 static void visionox_rm69299_remove(struct mipi_dsi_device *dsi)
 {
 	struct visionox_rm69299 *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(ctx->dsi);
 	drm_panel_remove(&ctx->panel);
 }
 
-- 
2.43.0


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

* [PATCH v3 6/6] drm/panel: Use devm_mipi_dsi_attach in assorted panels
  2026-08-12 13:04 [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels Osama Abdelkader
                   ` (3 preceding siblings ...)
  2026-08-12 13:04 ` [PATCH v3 5/6] drm/panel: Use devm_mipi_dsi_attach in display vendor panels Osama Abdelkader
@ 2026-08-12 13:04 ` Osama Abdelkader
  2026-08-12 13:18   ` sashiko-bot
  2026-08-12 13:13 ` [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels sashiko-bot
  2026-08-12 13:26 ` Maxime Ripard
  6 siblings, 1 reply; 14+ messages in thread
From: Osama Abdelkader @ 2026-08-12 13:04 UTC (permalink / raw)
  To: luca.ceresoli, Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Joel Selvaraj, Icenowy Zheng, Jagan Teki, Sumit Semwal,
	Casey Connolly, Michael Tretter, Guido Günther,
	Purism Kernel Team, Ondrej Jirman, Sasha Finkelstein,
	Janne Grunau, Michael Trimarchi, dri-devel, linux-kernel, asahi
  Cc: Osama Abdelkader

Use the managed MIPI DSI attach helper in the remaining straightforward
panel drivers and drop the corresponding manual detach calls from remove
paths.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>

---
v3:
- Move the changelog after the `---`.

v2:
- break long description lines.
- add Signed-off-by tag

 drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c  | 9 +--------
 drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c     | 8 +-------
 drivers/gpu/drm/panel/panel-dsi-cm.c                  | 4 +---
 drivers/gpu/drm/panel/panel-ebbg-ft8719.c             | 8 +-------
 drivers/gpu/drm/panel/panel-elida-kd35t133.c          | 8 +-------
 drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c     | 4 +---
 drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c | 4 +---
 drivers/gpu/drm/panel/panel-hydis-hv101hd1.c          | 9 +--------
 drivers/gpu/drm/panel/panel-innolux-p079zca.c         | 8 +-------
 drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c      | 4 +---
 drivers/gpu/drm/panel/panel-khadas-ts050.c            | 8 +-------
 drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c    | 7 +------
 drivers/gpu/drm/panel/panel-lg-sw43408.c              | 8 +-------
 drivers/gpu/drm/panel/panel-lincolntech-lcd197.c      | 8 +-------
 drivers/gpu/drm/panel/panel-lxd-m9189a.c              | 8 +-------
 drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c      | 4 +---
 drivers/gpu/drm/panel/panel-newvision-nv3051d.c       | 8 +-------
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c      | 4 +---
 drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c    | 8 +-------
 drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c  | 7 +------
 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c          | 4 +---
 drivers/gpu/drm/panel/panel-simple.c                  | 8 +-------
 drivers/gpu/drm/panel/panel-sitronix-st7701.c         | 3 +--
 drivers/gpu/drm/panel/panel-sitronix-st7703.c         | 8 +-------
 drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c   | 8 +-------
 drivers/gpu/drm/panel/panel-summit.c                  | 4 +---
 drivers/gpu/drm/panel/panel-synaptics-r63353.c        | 8 +-------
 drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c          | 8 +-------
 drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c      | 8 +-------
 29 files changed, 29 insertions(+), 166 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c b/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
index db006576d704..63359416944f 100644
--- a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
+++ b/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
@@ -264,7 +264,7 @@ static int tm5p5_nt35596_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		return ret;
@@ -276,13 +276,6 @@ static int tm5p5_nt35596_probe(struct mipi_dsi_device *dsi)
 static void tm5p5_nt35596_remove(struct mipi_dsi_device *dsi)
 {
 	struct tm5p5_nt35596 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev,
-			"Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c b/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
index 562dc573528d..783ea9e9739d 100644
--- a/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
+++ b/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
@@ -292,7 +292,7 @@ static int ch13726a_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -305,12 +305,6 @@ static int ch13726a_probe(struct mipi_dsi_device *dsi)
 static void ch13726a_remove(struct mipi_dsi_device *dsi)
 {
 	struct ch13726a_panel *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c b/drivers/gpu/drm/panel/panel-dsi-cm.c
index ae6e9ffc46cb..329252416aa3 100644
--- a/drivers/gpu/drm/panel/panel-dsi-cm.c
+++ b/drivers/gpu/drm/panel/panel-dsi-cm.c
@@ -561,7 +561,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ddata->panel);
 
-	r = mipi_dsi_attach(dsi);
+	r = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (r < 0)
 		goto err_dsi_attach;
 
@@ -583,8 +583,6 @@ static void dsicm_remove(struct mipi_dsi_device *dsi)
 
 	dev_dbg(&dsi->dev, "remove\n");
 
-	mipi_dsi_detach(dsi);
-
 	drm_panel_remove(&ddata->panel);
 
 	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
diff --git a/drivers/gpu/drm/panel/panel-ebbg-ft8719.c b/drivers/gpu/drm/panel/panel-ebbg-ft8719.c
index fb9f9f42be4f..7b93eabbf65d 100644
--- a/drivers/gpu/drm/panel/panel-ebbg-ft8719.c
+++ b/drivers/gpu/drm/panel/panel-ebbg-ft8719.c
@@ -204,7 +204,7 @@ static int ebbg_ft8719_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -217,12 +217,6 @@ static int ebbg_ft8719_probe(struct mipi_dsi_device *dsi)
 static void ebbg_ft8719_remove(struct mipi_dsi_device *dsi)
 {
 	struct ebbg_ft8719 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index d23002b5a2d7..fdc4bbef5f63 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -256,7 +256,7 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "mipi_dsi_attach failed: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -269,12 +269,6 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi)
 static void kd35t133_remove(struct mipi_dsi_device *dsi)
 {
 	struct kd35t133 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
index 8c3a231c147d..13546faa07ad 100644
--- a/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
+++ b/drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
@@ -474,7 +474,7 @@ static int k101_im2ba02_dsi_probe(struct mipi_dsi_device *dsi)
 	dsi->format = MIPI_DSI_FMT_RGB888;
 	dsi->lanes = 4;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		drm_panel_remove(&ctx->panel);
 		return ret;
@@ -486,8 +486,6 @@ static int k101_im2ba02_dsi_probe(struct mipi_dsi_device *dsi)
 static void k101_im2ba02_dsi_remove(struct mipi_dsi_device *dsi)
 {
 	struct k101_im2ba02 *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
index c1d8ca5ca6e1..8d16a7254d4e 100644
--- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
+++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
@@ -219,7 +219,7 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi)
 	dsi->format = MIPI_DSI_FMT_RGB888;
 	dsi->lanes = 4;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		drm_panel_remove(&ctx->panel);
 		return ret;
@@ -231,8 +231,6 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi)
 static void feiyang_dsi_remove(struct mipi_dsi_device *dsi)
 {
 	struct feiyang *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-hydis-hv101hd1.c b/drivers/gpu/drm/panel/panel-hydis-hv101hd1.c
index 0a96eb0fae1e..7c322aed7222 100644
--- a/drivers/gpu/drm/panel/panel-hydis-hv101hd1.c
+++ b/drivers/gpu/drm/panel/panel-hydis-hv101hd1.c
@@ -144,7 +144,7 @@ static int hv101hd1_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&hv->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret) {
 		drm_panel_remove(&hv->panel);
 		return dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
@@ -156,13 +156,6 @@ static int hv101hd1_probe(struct mipi_dsi_device *dsi)
 static void hv101hd1_remove(struct mipi_dsi_device *dsi)
 {
 	struct hv101hd1 *hv = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev,
-			"Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&hv->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
index 80afeeab9475..5eafddafe4ab 100644
--- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
+++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
@@ -444,7 +444,7 @@ static int innolux_panel_probe(struct mipi_dsi_device *dsi)
 	if (err < 0)
 		return err;
 
-	err = mipi_dsi_attach(dsi);
+	err = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (err < 0) {
 		innolux = mipi_dsi_get_drvdata(dsi);
 		innolux_panel_del(innolux);
@@ -457,12 +457,6 @@ static int innolux_panel_probe(struct mipi_dsi_device *dsi)
 static void innolux_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct innolux_panel *innolux = mipi_dsi_get_drvdata(dsi);
-	int err;
-
-
-	err = mipi_dsi_detach(dsi);
-	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
 
 	innolux_panel_del(innolux);
 }
diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
index 5202c1ffc6e1..92ad445ca70f 100644
--- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
+++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
@@ -3251,7 +3251,7 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi)
 	jadard->dsi = dsi;
 	jadard->desc = desc;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0)
 		drm_panel_remove(&jadard->panel);
 
@@ -3261,8 +3261,6 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi)
 static void jadard_dsi_remove(struct mipi_dsi_device *dsi)
 {
 	struct jadard *jadard = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&jadard->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-khadas-ts050.c b/drivers/gpu/drm/panel/panel-khadas-ts050.c
index 67ca055f06f3..5325c0f86324 100644
--- a/drivers/gpu/drm/panel/panel-khadas-ts050.c
+++ b/drivers/gpu/drm/panel/panel-khadas-ts050.c
@@ -862,7 +862,7 @@ static int khadas_ts050_panel_probe(struct mipi_dsi_device *dsi)
 	if (err < 0)
 		return err;
 
-	err = mipi_dsi_attach(dsi);
+	err = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (err)
 		drm_panel_remove(&khadas_ts050->base);
 
@@ -872,12 +872,6 @@ static int khadas_ts050_panel_probe(struct mipi_dsi_device *dsi)
 static void khadas_ts050_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct khadas_ts050_panel *khadas_ts050 = mipi_dsi_get_drvdata(dsi);
-	int err;
-
-	err = mipi_dsi_detach(dsi);
-	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
-
 	drm_panel_remove(&khadas_ts050->base);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
index 893af9b16756..af0a04a6374d 100644
--- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
+++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
@@ -375,7 +375,7 @@ static int kingdisplay_panel_probe(struct mipi_dsi_device *dsi)
 	if (err < 0)
 		return err;
 
-	err = mipi_dsi_attach(dsi);
+	err = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (err < 0) {
 		kingdisplay_panel_del(kingdisplay);
 		return err;
@@ -387,11 +387,6 @@ static int kingdisplay_panel_probe(struct mipi_dsi_device *dsi)
 static void kingdisplay_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct kingdisplay_panel *kingdisplay = mipi_dsi_get_drvdata(dsi);
-	int err;
-
-	err = mipi_dsi_detach(dsi);
-	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
 
 	kingdisplay_panel_del(kingdisplay);
 }
diff --git a/drivers/gpu/drm/panel/panel-lg-sw43408.c b/drivers/gpu/drm/panel/panel-lg-sw43408.c
index 293826c5006b..20238ad31567 100644
--- a/drivers/gpu/drm/panel/panel-lg-sw43408.c
+++ b/drivers/gpu/drm/panel/panel-lg-sw43408.c
@@ -294,18 +294,12 @@ static int sw43408_probe(struct mipi_dsi_device *dsi)
 
 	dsi->dsc = &ctx->dsc;
 
-	return mipi_dsi_attach(dsi);
+	return devm_mipi_dsi_attach(&dsi->dev, dsi);
 }
 
 static void sw43408_remove(struct mipi_dsi_device *dsi)
 {
 	struct sw43408_panel *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->base);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-lincolntech-lcd197.c b/drivers/gpu/drm/panel/panel-lincolntech-lcd197.c
index 24b34443ace0..22c7e94bc587 100644
--- a/drivers/gpu/drm/panel/panel-lincolntech-lcd197.c
+++ b/drivers/gpu/drm/panel/panel-lincolntech-lcd197.c
@@ -221,7 +221,7 @@ static int lincoln_lcd197_panel_probe(struct mipi_dsi_device *dsi)
 		return err;
 
 	drm_panel_add(&lcd->panel);
-	err = mipi_dsi_attach(dsi);
+	err = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (err)
 		drm_panel_remove(&lcd->panel);
 
@@ -231,12 +231,6 @@ static int lincoln_lcd197_panel_probe(struct mipi_dsi_device *dsi)
 static void lincoln_lcd197_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct lincoln_lcd197_panel *lcd = mipi_dsi_get_drvdata(dsi);
-	int err;
-
-	err = mipi_dsi_detach(dsi);
-	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
-
 	drm_panel_remove(&lcd->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-lxd-m9189a.c b/drivers/gpu/drm/panel/panel-lxd-m9189a.c
index baaf170779e0..bb64097d7bb0 100644
--- a/drivers/gpu/drm/panel/panel-lxd-m9189a.c
+++ b/drivers/gpu/drm/panel/panel-lxd-m9189a.c
@@ -202,7 +202,7 @@ static int lxd_m9189_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&m9189->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err_probe(dev, ret, "Failed to attach to DSI host\n");
 		drm_panel_remove(&m9189->panel);
@@ -215,12 +215,6 @@ static int lxd_m9189_probe(struct mipi_dsi_device *dsi)
 static void lxd_m9189_remove(struct mipi_dsi_device *dsi)
 {
 	struct m9189_panel *m9189 = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&m9189->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
index 27e188bb2d7f..50f835c7d84a 100644
--- a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
+++ b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
@@ -280,7 +280,7 @@ static int mantix_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "mipi_dsi_attach failed (%d). Is host ready?\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -298,8 +298,6 @@ static int mantix_probe(struct mipi_dsi_device *dsi)
 static void mantix_remove(struct mipi_dsi_device *dsi)
 {
 	struct mantix *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
index 22560384e48e..31b95ee49fae 100644
--- a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
+++ b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
@@ -399,7 +399,7 @@ static int panel_nv3051d_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "mipi_dsi_attach failed: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -421,14 +421,8 @@ static void panel_nv3051d_shutdown(struct mipi_dsi_device *dsi)
 static void panel_nv3051d_remove(struct mipi_dsi_device *dsi)
 {
 	struct panel_nv3051d *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
 	panel_nv3051d_shutdown(dsi);
 
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index 130520558a81..2a96acc96f2f 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -434,7 +434,7 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "mipi_dsi_attach failed. Is host ready?\n");
 		drm_panel_remove(&ctx->panel);
@@ -447,8 +447,6 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
 static void otm8009a_remove(struct mipi_dsi_device *dsi)
 {
 	struct otm8009a *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
index 63ae9dc5712f..c7cd7a7101cc 100644
--- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
+++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
@@ -172,7 +172,7 @@ static int osd101t2587_panel_probe(struct mipi_dsi_device *dsi)
 	if (ret < 0)
 		return ret;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret)
 		drm_panel_remove(&osd101t2587->base);
 
@@ -182,13 +182,7 @@ static int osd101t2587_panel_probe(struct mipi_dsi_device *dsi)
 static void osd101t2587_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct osd101t2587_panel *osd101t2587 = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
 	drm_panel_remove(&osd101t2587->base);
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
 }
 
 static struct mipi_dsi_driver osd101t2587_panel_driver = {
diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
index d21d93a0700e..f37e069c57d6 100644
--- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
+++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
@@ -210,7 +210,7 @@ static int wuxga_nt_panel_probe(struct mipi_dsi_device *dsi)
 	if (ret < 0)
 		return ret;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		wuxga_nt_panel_del(wuxga_nt);
 		return ret;
@@ -222,11 +222,6 @@ static int wuxga_nt_panel_probe(struct mipi_dsi_device *dsi)
 static void wuxga_nt_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct wuxga_nt_panel *wuxga_nt = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
 
 	wuxga_nt_panel_del(wuxga_nt);
 }
diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
index c3fbc459c7e0..d9bb7066964a 100644
--- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
+++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
@@ -198,7 +198,7 @@ static int rb070d30_panel_dsi_probe(struct mipi_dsi_device *dsi)
 	dsi->format = MIPI_DSI_FMT_RGB888;
 	dsi->lanes = 4;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		drm_panel_remove(&ctx->panel);
 		return ret;
@@ -210,8 +210,6 @@ static int rb070d30_panel_dsi_probe(struct mipi_dsi_device *dsi)
 static void rb070d30_panel_dsi_remove(struct mipi_dsi_device *dsi)
 {
 	struct rb070d30_panel *ctx = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index c95964ba25a9..c52d30f472c2 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -6551,7 +6551,7 @@ static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
 	dsi->format = desc->format;
 	dsi->lanes = desc->lanes;
 
-	err = mipi_dsi_attach(dsi);
+	err = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (err) {
 		struct panel_simple *panel = mipi_dsi_get_drvdata(dsi);
 
@@ -6563,12 +6563,6 @@ static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
 
 static void panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
 {
-	int err;
-
-	err = mipi_dsi_detach(dsi);
-	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
-
 	panel_simple_remove(&dsi->dev);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
index f16e0de1ea60..b45e2e683fe9 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -1347,7 +1347,7 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
 	dsi->format = st7701->desc->format;
 	dsi->lanes = st7701->desc->lanes;
 
-	err = mipi_dsi_attach(dsi);
+	err = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (err)
 		return dev_err_probe(&dsi->dev, err, "Failed to init MIPI DSI\n");
 
@@ -1381,7 +1381,6 @@ static int st7701_spi_probe(struct spi_device *spi)
 
 static void st7701_dsi_remove(struct mipi_dsi_device *dsi)
 {
-	mipi_dsi_detach(dsi);
 }
 
 static const struct of_device_id st7701_dsi_of_match[] = {
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index 70f7282471e6..8b737651b628 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -979,7 +979,7 @@ static int st7703_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "mipi_dsi_attach failed (%d). Is host ready?\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -998,12 +998,6 @@ static int st7703_probe(struct mipi_dsi_device *dsi)
 static void st7703_remove(struct mipi_dsi_device *dsi)
 {
 	struct st7703 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 
 	st7703_debugfs_remove(ctx);
diff --git a/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c b/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c
index 7f04b7b404e7..064e2d2e3045 100644
--- a/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c
+++ b/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c
@@ -315,7 +315,7 @@ static int stk_panel_probe(struct mipi_dsi_device *dsi)
 	if (ret < 0)
 		return ret;
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0)
 		drm_panel_remove(&stk->base);
 
@@ -325,12 +325,6 @@ static int stk_panel_probe(struct mipi_dsi_device *dsi)
 static void stk_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct stk_panel *stk = mipi_dsi_get_drvdata(dsi);
-	int err;
-
-	err = mipi_dsi_detach(dsi);
-	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n",
-			err);
 
 	drm_panel_remove(&stk->base);
 }
diff --git a/drivers/gpu/drm/panel/panel-summit.c b/drivers/gpu/drm/panel/panel-summit.c
index 84435be52424..24db8a1353a0 100644
--- a/drivers/gpu/drm/panel/panel-summit.c
+++ b/drivers/gpu/drm/panel/panel-summit.c
@@ -90,14 +90,12 @@ static int summit_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&s_data->panel);
 
-	return mipi_dsi_attach(dsi);
+	return devm_mipi_dsi_attach(&dsi->dev, dsi);
 }
 
 static void summit_remove(struct mipi_dsi_device *dsi)
 {
 	struct summit_data *s_data = mipi_dsi_get_drvdata(dsi);
-
-	mipi_dsi_detach(dsi);
 	drm_panel_remove(&s_data->panel);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-synaptics-r63353.c b/drivers/gpu/drm/panel/panel-synaptics-r63353.c
index 3a74d48753d9..ea3fbd0c8662 100644
--- a/drivers/gpu/drm/panel/panel-synaptics-r63353.c
+++ b/drivers/gpu/drm/panel/panel-synaptics-r63353.c
@@ -267,7 +267,7 @@ static int r63353_panel_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&panel->base);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "mipi_dsi_attach failed: %d\n", ret);
 		drm_panel_remove(&panel->base);
@@ -281,12 +281,6 @@ static void r63353_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct r63353_panel *rpanel = mipi_dsi_get_drvdata(dsi);
 	struct device *dev = &dsi->dev;
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(dev, "Failed to detach from host (%d)\n", ret);
-
 	drm_panel_remove(&rpanel->base);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c b/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c
index 13cfe252a838..92231716568b 100644
--- a/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c
+++ b/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c
@@ -195,18 +195,12 @@ static int tdo_tl070wsh30_panel_probe(struct mipi_dsi_device *dsi)
 	if (err < 0)
 		return err;
 
-	return mipi_dsi_attach(dsi);
+	return devm_mipi_dsi_attach(&dsi->dev, dsi);
 }
 
 static void tdo_tl070wsh30_panel_remove(struct mipi_dsi_device *dsi)
 {
 	struct tdo_tl070wsh30_panel *tdo_tl070wsh30 = mipi_dsi_get_drvdata(dsi);
-	int err;
-
-	err = mipi_dsi_detach(dsi);
-	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
-
 	drm_panel_remove(&tdo_tl070wsh30->base);
 }
 
diff --git a/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c b/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c
index fc6516373b5d..f19ffc959115 100644
--- a/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c
+++ b/drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c
@@ -276,7 +276,7 @@ static int xpp055c272_probe(struct mipi_dsi_device *dsi)
 
 	drm_panel_add(&ctx->panel);
 
-	ret = mipi_dsi_attach(dsi);
+	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
 	if (ret < 0) {
 		dev_err(dev, "mipi_dsi_attach failed: %d\n", ret);
 		drm_panel_remove(&ctx->panel);
@@ -289,12 +289,6 @@ static int xpp055c272_probe(struct mipi_dsi_device *dsi)
 static void xpp055c272_remove(struct mipi_dsi_device *dsi)
 {
 	struct xpp055c272 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
-
 	drm_panel_remove(&ctx->panel);
 }
 
-- 
2.43.0


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

* Re: [PATCH v3 5/6] drm/panel: Use devm_mipi_dsi_attach in display vendor panels
  2026-08-12 13:04 ` [PATCH v3 5/6] drm/panel: Use devm_mipi_dsi_attach in display vendor panels Osama Abdelkader
@ 2026-08-12 13:12   ` sashiko-bot
  0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-08-12 13:12 UTC (permalink / raw)
  To: Osama Abdelkader; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing `drm_panel_remove()` on DSI attach failure leaves a dangling pointer in the global panel list.
--

--- Patch [5]: [PATCH v3 5/6] drm/panel: Use devm_mipi_dsi_attach in display vendor panels ---
commit 861964400906b56ec8ecf322e4a2fb68f45fa468
Author: Osama Abdelkader <osama.abdelkader@gmail.com>

drm/panel: Use devm_mipi_dsi_attach in display vendor panels

This patch converts several MIPI DSI panel drivers to use the managed
devm_mipi_dsi_attach() helper and removes the manual detach calls from
their respective remove functions.

> diff --git a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> --- a/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> +++ b/drivers/gpu/drm/panel/panel-jdi-fhd-r63452.c
> @@ -202,7 +202,7 @@ static int jdi_fhd_r63452_probe(struct mipi_dsi_device *dsi)
>  
>  	drm_panel_add(&ctx->panel);
>  
> -	ret = mipi_dsi_attach(dsi);
> +	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
>  	if (ret < 0) {
>  		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
>  		return ret;

[Severity: High]
This isn't a bug introduced by this patch, but shouldn't we call
drm_panel_remove() before returning here?

Since the panel context is allocated using devm_drm_panel_alloc() earlier in
jdi_fhd_r63452_probe(), returning an error will cause devres to automatically
free the memory.

Because drm_panel_add() was called right before the attach attempt, will this
leave a dangling pointer in the global panel_list? It looks like this could
result in a use-after-free or list corruption the next time the list is
traversed.

Several of the other panel drivers updated in this patch (such as
ltk050h3146w) correctly call drm_panel_remove() in this error path.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812130429.16850-1-osama.abdelkader@gmail.com?part=5

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

* Re: [PATCH v3 4/6] drm/panel: Use devm_mipi_dsi_attach in Himax and Ilitek panels
  2026-08-12 13:04 ` [PATCH v3 4/6] drm/panel: Use devm_mipi_dsi_attach in Himax and Ilitek panels Osama Abdelkader
@ 2026-08-12 13:13   ` sashiko-bot
  0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-08-12 13:13 UTC (permalink / raw)
  To: Osama Abdelkader; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing `drm_panel_remove()` in the error path of `ili9881c_dsi_probe()` when `devm_mipi_dsi_attach()` fails, leaving a dangling pointer in the global panel list and causing a Use-After-Free.
--

--- Patch [4]: [PATCH v3 4/6] drm/panel: Use devm_mipi_dsi_attach in Himax and Ilitek panels ---
commit 3a10b5f724df17d382396b95194d7b29446eceae
Author: Osama Abdelkader <osama.abdelkader@gmail.com>

drm/panel: Use devm_mipi_dsi_attach in Himax and Ilitek panels

Use the managed MIPI DSI attach helper in Himax and Ilitek panel drivers
and drop the corresponding manual detach calls from remove paths.

> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> index 3abdd0870e831..ca7037a4242c7 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> @@ -2597,14 +2597,12 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
>  	dsi->format = MIPI_DSI_FMT_RGB888;
>  	dsi->lanes = ctx->desc->lanes;
>  
> -	return mipi_dsi_attach(dsi);
> +	return devm_mipi_dsi_attach(&dsi->dev, dsi);
>  }

[Severity: High]
This is a pre-existing issue, but if devm_mipi_dsi_attach() fails here,
does it leave a dangling pointer in the global panel list?

Since ili9881c_dsi_probe() directly returns the result of the attach attempt
without calling drm_panel_remove() on failure, and the panel context
was allocated with devm_drm_panel_alloc(), the devres cleanup will free
the memory while it remains linked in panel_list.

Could this cause a use-after-free when the list is next traversed?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812130429.16850-1-osama.abdelkader@gmail.com?part=4

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

* Re: [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels
  2026-08-12 13:04 [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels Osama Abdelkader
                   ` (4 preceding siblings ...)
  2026-08-12 13:04 ` [PATCH v3 6/6] drm/panel: Use devm_mipi_dsi_attach in assorted panels Osama Abdelkader
@ 2026-08-12 13:13 ` sashiko-bot
  2026-08-12 13:26 ` Maxime Ripard
  6 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-08-12 13:13 UTC (permalink / raw)
  To: Osama Abdelkader; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing drm_panel_remove() on devm_mipi_dsi_attach() error path in boe_bf060y8m_aj0_probe() causes a dangling pointer and use-after-free.
--

--- Patch [1]: [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels ---
commit 1f4d2947471e6cb49ce506f1077843c672e21899
Author: Osama Abdelkader <osama.abdelkader@gmail.com>

drm/panel: Use devm_mipi_dsi_attach in BOE panels

Use the managed MIPI DSI attach helper in BOE panel drivers and drop the
corresponding manual detach calls from remove paths.

> diff --git a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> index 84c21c62a43e4..6a74523a66141 100644
> --- a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> +++ b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> @@ -359,7 +359,7 @@ static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi)
>  
>  	drm_panel_add(&boe->panel);
>  
> -	ret = mipi_dsi_attach(dsi);
> +	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
>  	if (ret < 0) {
>  		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
>  		return ret;

[Severity: High]
This is a pre-existing issue, but should drm_panel_remove(&boe->panel) be
called on this error path?

In boe_bf060y8m_aj0_probe(), drm_panel_add() inserts the panel into the
global panel_list. If devm_mipi_dsi_attach() fails, the function returns an
error without calling drm_panel_remove().

During probe failure, the devres cleanup drops the panel's refcount but it
remains in the global panel_list since the refcount doesn't reach zero. If
another driver later looks up this panel (e.g., via of_drm_find_panel())
and invokes its operations, it will dereference freed devres-managed resources
like boe->reset_gpio, causing a use-after-free.

Other BOE panel drivers updated in this patch seem to correctly handle this
cleanup.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812130429.16850-1-osama.abdelkader@gmail.com?part=1

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

* Re: [PATCH v3 3/6] drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels
  2026-08-12 13:04 ` [PATCH v3 3/6] drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels Osama Abdelkader
@ 2026-08-12 13:16   ` sashiko-bot
  0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-08-12 13:16 UTC (permalink / raw)
  To: Osama Abdelkader; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but there is a Use-After-Free in the driver unbind path due to an ignored error return value from devm_mipi_dsi_attach.
--

--- Patch [3]: [PATCH v3 3/6] drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels ---
commit 4038e87306192174f8d35deb13351bd8c956f7e3
Author: Osama Abdelkader <osama.abdelkader@gmail.com>

drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels

Use the managed MIPI DSI attach helper in Novatek and Raydium panel
drivers and drop the corresponding manual detach calls from remove paths.

> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35510.c b/drivers/gpu/drm/panel/panel-novatek-nt35510.c
> index 3189d89c7ca00..e75b6ac3df5c3 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt35510.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt35510.c
> @@ -1175,7 +1175,7 @@ static int nt35510_probe(struct mipi_dsi_device *dsi)
>  
>  	drm_panel_add(&nt->panel);
>  
> -	ret = mipi_dsi_attach(dsi);
> +	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
>  	if (ret < 0)
>  		drm_panel_remove(&nt->panel);

[Severity: High]
This is a pre-existing issue, but if devm_mipi_dsi_attach() fails here,
drm_panel_remove() is called, but the nt35510_probe() function still
returns 0 (success) immediately after this. Because probe succeeds, devres
cleanup isn't triggered at probe time.

[ ... ]

> @@ -1186,8 +1186,6 @@ static void nt35510_remove(struct mipi_dsi_device *dsi)
>  {
>  	struct nt35510 *nt = mipi_dsi_get_drvdata(dsi);
>  	int ret;
> -
> -	mipi_dsi_detach(dsi);

[Severity: High]
This isn't a bug introduced by this patch, but when the driver is later unbound,
nt35510_remove() calls drm_panel_remove() a second time. This drops the
refcount to 0, freeing the panel memory prematurely. 

After nt35510_remove() completes, the devres cleanup handlers execute,
including drm_panel_put_void(), which will access the already freed panel
memory resulting in a use-after-free.

Should nt35510_probe() return the error code instead of 0 when
devm_mipi_dsi_attach() fails?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812130429.16850-1-osama.abdelkader@gmail.com?part=3

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

* Re: [PATCH v3 6/6] drm/panel: Use devm_mipi_dsi_attach in assorted panels
  2026-08-12 13:04 ` [PATCH v3 6/6] drm/panel: Use devm_mipi_dsi_attach in assorted panels Osama Abdelkader
@ 2026-08-12 13:18   ` sashiko-bot
  0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-08-12 13:18 UTC (permalink / raw)
  To: Osama Abdelkader; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

New issues:
- [Low] Unused local variable 'dev' left behind after removing error handling.

Pre-existing issues:
- [High] Missing drm_panel_remove() on devm_mipi_dsi_attach() failure causes Use-After-Free.
- [High] DCS commands sent over a detached DSI bus during st7701 cleanup.
--

--- Patch [6]: [PATCH v3 6/6] drm/panel: Use devm_mipi_dsi_attach in assorted panels ---
commit 7405393b6171044f855c59f559f223d4f0b22c36
Author: Osama Abdelkader <osama.abdelkader@gmail.com>

drm/panel: Use devm_mipi_dsi_attach in assorted panels

This commit converts multiple panel drivers to use the managed
devm_mipi_dsi_attach helper. It drops the corresponding manual detach
calls from the remove paths of these drivers.

> diff --git a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c b/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
> index db006576d7046..63359416944fe 100644
> --- a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
> +++ b/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
[ ... ]
> @@ -264,7 +264,7 @@ static int tm5p5_nt35596_probe(struct mipi_dsi_device *dsi)
>  
>  	drm_panel_add(&ctx->panel);
>  
> -	ret = mipi_dsi_attach(dsi);
> +	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
>  	if (ret < 0) {

[Severity: High]
This isn't a bug introduced by this patch, but if the attach fails here,
does this return the error code without calling drm_panel_remove()?

Because the panel struct was allocated using devm_drm_panel_alloc(), devres
will automatically free the memory upon probe failure. However, the panel
would remain linked in the global panel_list, which could cause a
use-after-free when the list is iterated.

This pattern appears to be present in multiple drivers modified in this
patch (like panel-lg-sw43408.c, panel-summit.c, and panel-tdo-tl070wsh30.c).

>  		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
>  		return ret;
>  	}

[ ... ]
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> index f16e0de1ea606..b45e2e683fe9f 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
[ ... ]
> @@ -1347,7 +1347,7 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
>  	dsi->format = st7701->desc->format;
>  	dsi->lanes = st7701->desc->lanes;
>  
> -	err = mipi_dsi_attach(dsi);
> +	err = devm_mipi_dsi_attach(&dsi->dev, dsi);

[Severity: High]
This is a pre-existing issue, but does this lead to DCS commands being
sent over a detached DSI bus during cleanup?

The st7701_probe() function registers the st7701_cleanup() devres action
which eventually calls drm_panel_unprepare() and sends a sleep command.
Because devm_mipi_dsi_attach() is called after st7701_probe(), the detach
devres action is registered last.

Since devres executes in LIFO order, the bus will be detached before
st7701_cleanup() attempts to send the sleep command.

>  	if (err)
>  		return dev_err_probe(&dsi->dev, err, "Failed to init MIPI DSI\n");

[ ... ]
> diff --git a/drivers/gpu/drm/panel/panel-synaptics-r63353.c b/drivers/gpu/drm/panel/panel-synaptics-r63353.c
> index 3a74d48753d9c..ea3fbd0c8662e 100644
> --- a/drivers/gpu/drm/panel/panel-synaptics-r63353.c
> +++ b/drivers/gpu/drm/panel/panel-synaptics-r63353.c
[ ... ]
> @@ -281,12 +281,6 @@ static void r63353_panel_remove(struct mipi_dsi_device *dsi)
>  {
>  	struct r63353_panel *rpanel = mipi_dsi_get_drvdata(dsi);
>  	struct device *dev = &dsi->dev;
> -	int ret;
> -
> -	ret = mipi_dsi_detach(dsi);
> -	if (ret < 0)
> -		dev_err(dev, "Failed to detach from host (%d)\n", ret);
> -

[Severity: Low]
With the error logging removed, is the dev variable now unused and safe
to remove from r63353_panel_remove() to avoid a compiler warning?

>  	drm_panel_remove(&rpanel->base);
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812130429.16850-1-osama.abdelkader@gmail.com?part=6

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

* Re: [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels
  2026-08-12 13:04 [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels Osama Abdelkader
                   ` (5 preceding siblings ...)
  2026-08-12 13:13 ` [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels sashiko-bot
@ 2026-08-12 13:26 ` Maxime Ripard
  2026-08-12 13:45   ` Luca Ceresoli
  6 siblings, 1 reply; 14+ messages in thread
From: Maxime Ripard @ 2026-08-12 13:26 UTC (permalink / raw)
  To: Osama Abdelkader
  Cc: luca.ceresoli, Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
	Thomas Zimmermann, David Airlie, Simona Vetter, Jerry Han,
	dri-devel, linux-kernel

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

On Wed, Aug 12, 2026 at 03:04:18PM +0200, Osama Abdelkader wrote:
> Use the managed MIPI DSI attach helper in BOE panel drivers and drop the
> corresponding manual detach calls from remove paths.
> 
> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> 
> ---
> v3:
> - Move the changelog after the `---`.
> 
> v2:
> - break long description lines.
> - add Signed-off-by tag
> 
>  drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c       | 8 +-------
>  drivers/gpu/drm/panel/panel-boe-himax8279d.c         | 8 +-------
>  drivers/gpu/drm/panel/panel-boe-td4320.c             | 8 +-------
>  drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c | 4 +---
>  drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c       | 8 +-------
>  drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c       | 7 +------
>  6 files changed, 6 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> index 84c21c62a43e..6a74523a6614 100644
> --- a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> +++ b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> @@ -359,7 +359,7 @@ static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi)
>  
>  	drm_panel_add(&boe->panel);
>  
> -	ret = mipi_dsi_attach(dsi);
> +	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
>  	if (ret < 0) {
>  		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
>  		return ret;
> @@ -371,12 +371,6 @@ static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi)
>  static void boe_bf060y8m_aj0_remove(struct mipi_dsi_device *dsi)
>  {
>  	struct boe_bf060y8m_aj0 *boe = mipi_dsi_get_drvdata(dsi);
> -	int ret;
> -
> -	ret = mipi_dsi_detach(dsi);
> -	if (ret < 0)
> -		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
> -
>  	drm_panel_remove(&boe->panel);
>  }

mipi_dsi_detach is now called after drm_panel_remove. Your commit log
should mention it, and explain why it's not a concern.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

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

* Re: [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels
  2026-08-12 13:26 ` Maxime Ripard
@ 2026-08-12 13:45   ` Luca Ceresoli
  2026-08-12 14:23     ` Osama Abdelkader
  0 siblings, 1 reply; 14+ messages in thread
From: Luca Ceresoli @ 2026-08-12 13:45 UTC (permalink / raw)
  To: Maxime Ripard, Osama Abdelkader
  Cc: luca.ceresoli, Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
	Thomas Zimmermann, David Airlie, Simona Vetter, Jerry Han,
	dri-devel, linux-kernel

Hello,

On Wed Aug 12, 2026 at 3:26 PM CEST, Maxime Ripard wrote:
> On Wed, Aug 12, 2026 at 03:04:18PM +0200, Osama Abdelkader wrote:
>> Use the managed MIPI DSI attach helper in BOE panel drivers and drop the
>> corresponding manual detach calls from remove paths.
>>
>> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
>>
>> ---
>> v3:
>> - Move the changelog after the `---`.
>>
>> v2:
>> - break long description lines.
>> - add Signed-off-by tag
>>
>>  drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c       | 8 +-------
>>  drivers/gpu/drm/panel/panel-boe-himax8279d.c         | 8 +-------
>>  drivers/gpu/drm/panel/panel-boe-td4320.c             | 8 +-------
>>  drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c | 4 +---
>>  drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c       | 8 +-------
>>  drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c       | 7 +------
>>  6 files changed, 6 insertions(+), 37 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
>> index 84c21c62a43e..6a74523a6614 100644
>> --- a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
>> +++ b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
>> @@ -359,7 +359,7 @@ static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi)
>>
>>  	drm_panel_add(&boe->panel);
>>
>> -	ret = mipi_dsi_attach(dsi);
>> +	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
>>  	if (ret < 0) {
>>  		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
>>  		return ret;
>> @@ -371,12 +371,6 @@ static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi)
>>  static void boe_bf060y8m_aj0_remove(struct mipi_dsi_device *dsi)
>>  {
>>  	struct boe_bf060y8m_aj0 *boe = mipi_dsi_get_drvdata(dsi);
>> -	int ret;
>> -
>> -	ret = mipi_dsi_detach(dsi);
>> -	if (ret < 0)
>> -		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
>> -
>>  	drm_panel_remove(&boe->panel);
>>  }
>
> mipi_dsi_detach is now called after drm_panel_remove. Your commit log
> should mention it, and explain why it's not a concern.

Indeed. Or switch from drm_panel_add() to devm_drm_panel_add(), which would
avoid the issue mentioned by Maxime and cleanup even more the code.

Luca

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

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

* Re: [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels
  2026-08-12 13:45   ` Luca Ceresoli
@ 2026-08-12 14:23     ` Osama Abdelkader
  0 siblings, 0 replies; 14+ messages in thread
From: Osama Abdelkader @ 2026-08-12 14:23 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Maxime Ripard, Neil Armstrong, Jessica Zhang, Maarten Lankhorst,
	Thomas Zimmermann, David Airlie, Simona Vetter, Jerry Han,
	dri-devel, linux-kernel

On Wed, Aug 12, 2026 at 03:45:59PM +0200, Luca Ceresoli wrote:
> Hello,
> 
> On Wed Aug 12, 2026 at 3:26 PM CEST, Maxime Ripard wrote:
> > On Wed, Aug 12, 2026 at 03:04:18PM +0200, Osama Abdelkader wrote:
> >> Use the managed MIPI DSI attach helper in BOE panel drivers and drop the
> >> corresponding manual detach calls from remove paths.
> >>
> >> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> >>
> >> ---
> >> v3:
> >> - Move the changelog after the `---`.
> >>
> >> v2:
> >> - break long description lines.
> >> - add Signed-off-by tag
> >>
> >>  drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c       | 8 +-------
> >>  drivers/gpu/drm/panel/panel-boe-himax8279d.c         | 8 +-------
> >>  drivers/gpu/drm/panel/panel-boe-td4320.c             | 8 +-------
> >>  drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c | 4 +---
> >>  drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c       | 8 +-------
> >>  drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c       | 7 +------
> >>  6 files changed, 6 insertions(+), 37 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> >> index 84c21c62a43e..6a74523a6614 100644
> >> --- a/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> >> +++ b/drivers/gpu/drm/panel/panel-boe-bf060y8m-aj0.c
> >> @@ -359,7 +359,7 @@ static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi)
> >>
> >>  	drm_panel_add(&boe->panel);
> >>
> >> -	ret = mipi_dsi_attach(dsi);
> >> +	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
> >>  	if (ret < 0) {
> >>  		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
> >>  		return ret;
> >> @@ -371,12 +371,6 @@ static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi)
> >>  static void boe_bf060y8m_aj0_remove(struct mipi_dsi_device *dsi)
> >>  {
> >>  	struct boe_bf060y8m_aj0 *boe = mipi_dsi_get_drvdata(dsi);
> >> -	int ret;
> >> -
> >> -	ret = mipi_dsi_detach(dsi);
> >> -	if (ret < 0)
> >> -		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
> >> -
> >>  	drm_panel_remove(&boe->panel);
> >>  }
> >
> > mipi_dsi_detach is now called after drm_panel_remove. Your commit log
> > should mention it, and explain why it's not a concern.
> 
> Indeed. Or switch from drm_panel_add() to devm_drm_panel_add(), which would
> avoid the issue mentioned by Maxime and cleanup even more the code.
> 
> Luca
> 
> --
> Luca Ceresoli, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Thanks for the reviews, I updated that in v4.
Best regards,
Osama

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

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

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12 13:04 [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels Osama Abdelkader
2026-08-12 13:04 ` [PATCH v3 2/6] drm/panel: Use devm_mipi_dsi_attach in Samsung panels Osama Abdelkader
2026-08-12 13:04 ` [PATCH v3 3/6] drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels Osama Abdelkader
2026-08-12 13:16   ` sashiko-bot
2026-08-12 13:04 ` [PATCH v3 4/6] drm/panel: Use devm_mipi_dsi_attach in Himax and Ilitek panels Osama Abdelkader
2026-08-12 13:13   ` sashiko-bot
2026-08-12 13:04 ` [PATCH v3 5/6] drm/panel: Use devm_mipi_dsi_attach in display vendor panels Osama Abdelkader
2026-08-12 13:12   ` sashiko-bot
2026-08-12 13:04 ` [PATCH v3 6/6] drm/panel: Use devm_mipi_dsi_attach in assorted panels Osama Abdelkader
2026-08-12 13:18   ` sashiko-bot
2026-08-12 13:13 ` [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels sashiko-bot
2026-08-12 13:26 ` Maxime Ripard
2026-08-12 13:45   ` Luca Ceresoli
2026-08-12 14:23     ` Osama Abdelkader

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.