drm/panel: novatek-nt35950: Only unregister DSI1 if it exists

Commit 5dd45b6674 ("drm/panel: novatek-nt35950: Improve error handling")
introduced logic to unregister DSI1 on any sort of probe failure, as
that's not done automatically by kernel APIs.

It did not however account for cases where only one DSI host is used.
Fix that.

Fixes: 5dd45b6674 ("drm/panel: novatek-nt35950: Improve error handling")
Reported-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230417-topic-maple_panel_fixup-v1-1-07c8db606f5e@linaro.org
This commit is contained in:
Konrad Dybcio 2023-04-17 17:41:08 +02:00 committed by Neil Armstrong
parent ab4f869fba
commit a50be876f4
1 changed files with 4 additions and 2 deletions

View File

@ -586,7 +586,8 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
ret = drm_panel_of_backlight(&nt->panel);
if (ret) {
mipi_dsi_device_unregister(nt->dsi[1]);
if (num_dsis == 2)
mipi_dsi_device_unregister(nt->dsi[1]);
return dev_err_probe(dev, ret, "Failed to get backlight\n");
}
@ -606,7 +607,8 @@ 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]);
if (num_dsis == 2)
mipi_dsi_device_unregister(nt->dsi[1]);
return dev_err_probe(dev, ret,
"Cannot attach to DSI%d host.\n", i);