drm/panel: simple: Fix panel_simple_dsi_probe
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Tue, 26 Feb 2019 08:11:53 +0000 (10:11 +0200)
committerThierry Reding <treding@nvidia.com>
Tue, 23 Apr 2019 11:56:46 +0000 (13:56 +0200)
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
drivers/gpu/drm/panel/panel-simple.c

index 265d6ca44bbba8a8b36e031f5d8cbe433a6e7e0f..0865f4f421159a724343462acbdeaf7d6fdca0de 100644 (file)
@@ -3161,7 +3161,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)