drm/panel: simple: Fix panel_simple_dsi_probe [Linux 4.4.187]

This Linux kernel change "drm/panel: simple: Fix panel_simple_dsi_probe" is included in the Linux 4.4.187 release. This change is authored by Peter Ujfalusi <peter.ujfalusi [at] ti.com> on Tue Feb 26 10:11:53 2019 +0200. The commit for this change in Linux stable tree is 309e886 (patch) which is from upstream commit 7ad9db6. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 7ad9db6.

drm/panel: simple: Fix panel_simple_dsi_probe

[ Upstream commit 7ad9db66fafb0f0ad53fd2a66217105da5ddeffe ]

In case mipi_dsi_attach() fails remove the registered panel to avoid added
panel without corresponding device.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190226081153.31334-1-peter.ujfalusi@ti.com
Signed-off-by: Sasha Levin <sashal@kernel.org>

There are 9 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/gpu/drm/panel/panel-simple.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index f418c00..ecad4d7 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1389,7 +1389,14 @@ static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
    dsi->format = desc->format;
    dsi->lanes = desc->lanes;

-   return mipi_dsi_attach(dsi);
+   err = mipi_dsi_attach(dsi);
+   if (err) {
+       struct panel_simple *panel = dev_get_drvdata(&dsi->dev);
+       drm_panel_remove(&panel->base);
+   }
+   return err;

 static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)

Leave a Reply

Your email address will not be published. Required fields are marked *