Skip to content

Commit 5dd45b6

Browse files
konradybciosuperna9999
authored andcommitted
drm/panel: novatek-nt35950: Improve error handling
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: 623a353 ("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]
1 parent 56e5168 commit 5dd45b6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/gpu/drm/panel/panel-novatek-nt35950.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,11 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
585585
DRM_MODE_CONNECTOR_DSI);
586586

587587
ret = drm_panel_of_backlight(&nt->panel);
588-
if (ret)
588+
if (ret) {
589+
mipi_dsi_device_unregister(nt->dsi[1]);
590+
589591
return dev_err_probe(dev, ret, "Failed to get backlight\n");
592+
}
590593

591594
drm_panel_add(&nt->panel);
592595

@@ -602,6 +605,9 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
602605

603606
ret = mipi_dsi_attach(nt->dsi[i]);
604607
if (ret < 0) {
608+
/* If we fail to attach to either host, we're done */
609+
mipi_dsi_device_unregister(nt->dsi[1]);
610+
605611
return dev_err_probe(dev, ret,
606612
"Cannot attach to DSI%d host.\n", i);
607613
}

0 commit comments

Comments
 (0)