drm/panel: lg-sw43408: remove panel on DSI attach failure
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): Casey Connolly <[email protected]
PATCH 1/1 drm/panel: lg-sw43408: remove panel on DSI attach failure
The probe path registers the panel by calling drm_panel_add() in sw43408_add(), then returns the result of mipi_dsi_attach() directly from sw43408_probe().
If mipi_dsi_attach() fails, the probe path exits without calling drm_panel_remove(), leaving the panel registered in the global DRM panel list. The .remove() callback does not cover this case because it is only invoked after a successful probe.
Fix this by unwinding the panel registration with drm_panel_remove() when mipi_dsi_attach() fails.
--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-lg-sw43408.c +7 -1
@@ -294,7 +294,13 @@ static int sw43408_probe(struct mipi_dsi_device *dsi) dsi->dsc = &ctx->dsc; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +drm_panel_remove (&ctx->base); +return ret; + } + +return 0 ; }static void sw43408_remove (struct mipi_dsi_device *dsi)
Quoted 19 lines · Myeonghun Pak
The probe path registers the panel by calling
drm_panel_add()insw43408_add(), then returns the result ofmipi_dsi_attach()directly fromsw43408_probe().If
mipi_dsi_attach()fails, the probe path exits without callingdrm_panel_remove(), leaving the panel registered in the global DRM panel list. The .remove() callback does not cover this case because it is only invoked after a successful probe.Fix this by unwinding the panel registration with
drm_panel_remove()whenmipi_dsi_attach()fails.Co-developed-by Ijae Kim <[email protected]>Signed-off-by Ijae Kim <[email protected]>Co-developed-by Taegyu Kim <[email protected]>Signed-off-by Taegyu Kim <[email protected]>Co-developed-by Yuho Choi <[email protected]>Signed-off-by Yuho Choi <[email protected]>Signed-off-by Myeonghun Pak <[email protected]>
Quoted 4 lines
--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
You can also switch to devm_drm_panel_add().
Signature · 2 lines
With best wishes Dmitry
Dmitry, Understood. I will apply devm_drm_panel_add() to this patch as well in the next version, which will be submitted as part of the series. Thanks, Myeonghun Pak
2026년 4월 23일 (목) 오전 4:24, Dmitry Baryshkov <
[email protected]>님이 작성:
Quoted 31 lines · Myeonghun Pak
Quoted 19 lines
The probe path registers the panel by calling
drm_panel_add()insw43408_add(), then returns the result ofmipi_dsi_attach()directly fromsw43408_probe().If
mipi_dsi_attach()fails, the probe path exits without callingdrm_panel_remove(), leaving the panel registered in the global DRM panel list. The .remove() callback does not cover this case because it is only invoked after a successful probe.Fix this by unwinding the panel registration with
drm_panel_remove()whenmipi_dsi_attach()fails.Co-developed-by Ijae Kim <[email protected]>Signed-off-by Ijae Kim <[email protected]>Co-developed-by Taegyu Kim <[email protected]>Signed-off-by Taegyu Kim <[email protected]>Co-developed-by Yuho Choi <[email protected]>Signed-off-by Yuho Choi <[email protected]>Signed-off-by Myeonghun Pak <[email protected]>Quoted 4 lines
--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)You can also switch to
devm_drm_panel_add().--
With best wishes
Dmitry