diff mbox series

drm/panel: lg-sw43408: Fix an error handling path in sw43408_probe()

Message ID b8dfafaf1516b33dfc21e9ad27e31fe2a5820a5c.1716197626.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State New, archived
Headers show
Series drm/panel: lg-sw43408: Fix an error handling path in sw43408_probe() | expand

Commit Message

Christophe JAILLET May 20, 2024, 9:34 a.m. UTC
If mipi_dsi_attach() fails, we must undo the drm_panel_add() call hidden in
sw43408_add(), as already done in the remove function.

Fixes: 069a6c0e94f9 ("drm: panel: Add LG sw43408 panel driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 drivers/gpu/drm/panel/panel-lg-sw43408.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Dmitry Baryshkov May 20, 2024, 10:29 a.m. UTC | #1
On Mon, May 20, 2024 at 11:34:31AM +0200, Christophe JAILLET wrote:
> If mipi_dsi_attach() fails, we must undo the drm_panel_add() call hidden in
> sw43408_add(), as already done in the remove function.
> 
> Fixes: 069a6c0e94f9 ("drm: panel: Add LG sw43408 panel driver")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only
> ---
>  drivers/gpu/drm/panel/panel-lg-sw43408.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-lg-sw43408.c b/drivers/gpu/drm/panel/panel-lg-sw43408.c
index 115f4702d59f..27f2ad788d38 100644
--- a/drivers/gpu/drm/panel/panel-lg-sw43408.c
+++ b/drivers/gpu/drm/panel/panel-lg-sw43408.c
@@ -286,7 +286,15 @@  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)
+		goto err_remove_panel;
+
+	return 0;
+
+err_remove_panel:
+	drm_panel_remove(&ctx->base);
+	return ret;
 }
 
 static void sw43408_remove(struct mipi_dsi_device *dsi)