]> Git Repo - J-linux.git/commitdiff
drm/panel: novatek-nt35950: Improve error handling
authorKonrad Dybcio <[email protected]>
Sat, 15 Apr 2023 11:00:30 +0000 (13:00 +0200)
committerNeil Armstrong <[email protected]>
Mon, 17 Apr 2023 07:27:35 +0000 (09:27 +0200)
In a very peculiar case when probing and registering with the secondary
DSI host succeeds, but the OF backlight or DSI attachment fails, the
primary DSI device is automatically cleaned up, but the secondary one
is not, leading to -EEXIST when the driver core tries to handle
-EPROBE_DEFER.

Unregister the DSI1 device manually on failure to prevent that.

Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels")
Signed-off-by: Konrad Dybcio <[email protected]>
Reviewed-by: Neil Armstrong <[email protected]>
Signed-off-by: Neil Armstrong <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/panel/panel-novatek-nt35950.c

index abf752b36a523200970c7c35a326e159f74667fc..7498fc6258bb01fcca8bc191c19a883ffd44820a 100644 (file)
@@ -585,8 +585,11 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
                       DRM_MODE_CONNECTOR_DSI);
 
        ret = drm_panel_of_backlight(&nt->panel);
-       if (ret)
+       if (ret) {
+               mipi_dsi_device_unregister(nt->dsi[1]);
+
                return dev_err_probe(dev, ret, "Failed to get backlight\n");
+       }
 
        drm_panel_add(&nt->panel);
 
@@ -602,6 +605,9 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
 
                ret = mipi_dsi_attach(nt->dsi[i]);
                if (ret < 0) {
+                       /* If we fail to attach to either host, we're done */
+                       mipi_dsi_device_unregister(nt->dsi[1]);
+
                        return dev_err_probe(dev, ret,
                                             "Cannot attach to DSI%d host.\n", i);
                }
This page took 0.064831 seconds and 4 git commands to generate.