drivers/gpu/drm/panel/panel-lg-sw43408.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
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.
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Co-developed-by: Taegyu Kim <tmk5904@psu.edu>
Signed-off-by: Taegyu Kim <tmk5904@psu.edu>
Co-developed-by: Yuho Choi <dbgh9129@gmail.com>
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
drivers/gpu/drm/panel/panel-lg-sw43408.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panel/panel-lg-sw43408.c b/drivers/gpu/drm/panel/panel-lg-sw43408.c
index 293826c50..0eb78bc90 100644
--- a/drivers/gpu/drm/panel/panel-lg-sw43408.c
+++ b/drivers/gpu/drm/panel/panel-lg-sw43408.c
@@ -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)
--
On Mon, Apr 20, 2026 at 04:38:27PM +0900, Myeonghun Pak wrote: > 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. > > Co-developed-by: Ijae Kim <ae878000@gmail.com> > Signed-off-by: Ijae Kim <ae878000@gmail.com> > Co-developed-by: Taegyu Kim <tmk5904@psu.edu> > Signed-off-by: Taegyu Kim <tmk5904@psu.edu> > Co-developed-by: Yuho Choi <dbgh9129@gmail.com> > Signed-off-by: Yuho Choi <dbgh9129@gmail.com> > Signed-off-by: Myeonghun Pak <mhun512@gmail.com> > --- > 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
© 2016 - 2026 Red Hat, Inc.