* [PATCH] drm/panel: novatek-nt35950: Improve error handling
@ 2023-04-15 11:00 Konrad Dybcio
2023-04-17 7:25 ` Neil Armstrong
2023-04-17 7:28 ` Neil Armstrong
0 siblings, 2 replies; 7+ messages in thread
From: Konrad Dybcio @ 2023-04-15 11:00 UTC (permalink / raw)
To: Neil Armstrong, Sam Ravnborg, David Airlie, Daniel Vetter,
AngeloGioacchino Del Regno, AngeloGioacchino Del Regno
Cc: Marijn Suijten, dri-devel, linux-kernel, Konrad Dybcio
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 <konrad.dybcio@linaro.org>
---
drivers/gpu/drm/panel/panel-novatek-nt35950.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
index abf752b36a52..7498fc6258bb 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
@@ -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);
}
---
base-commit: 035ba5f9cf511b9299fd9c9d0688ef930d33c886
change-id: 20230415-konrad-longbois-next-847d57abb4d2
Best regards,
--
Konrad Dybcio <konrad.dybcio@linaro.org>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] drm/panel: novatek-nt35950: Improve error handling
2023-04-15 11:00 [PATCH] drm/panel: novatek-nt35950: Improve error handling Konrad Dybcio
@ 2023-04-17 7:25 ` Neil Armstrong
2023-04-17 9:44 ` AngeloGioacchino Del Regno
2023-04-17 7:28 ` Neil Armstrong
1 sibling, 1 reply; 7+ messages in thread
From: Neil Armstrong @ 2023-04-17 7:25 UTC (permalink / raw)
To: Konrad Dybcio, Sam Ravnborg, David Airlie, Daniel Vetter,
AngeloGioacchino Del Regno, AngeloGioacchino Del Regno
Cc: Marijn Suijten, dri-devel, linux-kernel
On 15/04/2023 13:00, Konrad Dybcio wrote:
> 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 <konrad.dybcio@linaro.org>
> ---
> drivers/gpu/drm/panel/panel-novatek-nt35950.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
> index abf752b36a52..7498fc6258bb 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
> @@ -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);
> }
>
> ---
> base-commit: 035ba5f9cf511b9299fd9c9d0688ef930d33c886
> change-id: 20230415-konrad-longbois-next-847d57abb4d2
>
> Best regards,
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] drm/panel: novatek-nt35950: Improve error handling
2023-04-17 7:25 ` Neil Armstrong
@ 2023-04-17 9:44 ` AngeloGioacchino Del Regno
2023-04-17 9:44 ` AngeloGioacchino Del Regno
0 siblings, 1 reply; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-04-17 9:44 UTC (permalink / raw)
To: neil.armstrong, Konrad Dybcio, Sam Ravnborg, David Airlie,
Daniel Vetter, AngeloGioacchino Del Regno
Cc: Marijn Suijten, dri-devel, linux-kernel
Il 17/04/23 09:25, Neil Armstrong ha scritto:
> On 15/04/2023 13:00, Konrad Dybcio wrote:
>> 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 <konrad.dybcio@linaro.org>
>> ---
>> drivers/gpu/drm/panel/panel-novatek-nt35950.c | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>> b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>> index abf752b36a52..7498fc6258bb 100644
>> --- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>> +++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>> @@ -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) {
If this is not a dual-DSI case, nt->dsi[1] will be NULL: I agree it's still
fine as in the kernel won't crash in that case, but for logical correctness
I would still account for that:
if (num_dsis == 2)
mipi_dsi_device_unregister(nt->dsi[1]);
>> + 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) {
Same here, please add a check for num_dsis.
Regards,
Angelo
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] drm/panel: novatek-nt35950: Improve error handling
2023-04-17 9:44 ` AngeloGioacchino Del Regno
@ 2023-04-17 9:44 ` AngeloGioacchino Del Regno
2023-04-17 13:38 ` Konrad Dybcio
0 siblings, 1 reply; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-04-17 9:44 UTC (permalink / raw)
To: neil.armstrong, Konrad Dybcio, Sam Ravnborg, David Airlie,
Daniel Vetter, AngeloGioacchino Del Regno
Cc: Marijn Suijten, dri-devel, linux-kernel
Il 17/04/23 11:44, AngeloGioacchino Del Regno ha scritto:
> Il 17/04/23 09:25, Neil Armstrong ha scritto:
>> On 15/04/2023 13:00, Konrad Dybcio wrote:
>>> 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 <konrad.dybcio@linaro.org>
>>> ---
>>> drivers/gpu/drm/panel/panel-novatek-nt35950.c | 8 +++++++-
>>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>>> b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>>> index abf752b36a52..7498fc6258bb 100644
>>> --- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>>> +++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>>> @@ -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) {
>
> If this is not a dual-DSI case, nt->dsi[1] will be NULL: I agree it's still
> fine as in the kernel won't crash in that case, but for logical correctness
> I would still account for that:
>
> if (num_dsis == 2)
> mipi_dsi_device_unregister(nt->dsi[1]);
>
>>> + 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) {
>
> Same here, please add a check for num_dsis.
>
> Regards,
> Angelo
Eh, too late, I just noticed that this got picked already...
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] drm/panel: novatek-nt35950: Improve error handling
2023-04-17 9:44 ` AngeloGioacchino Del Regno
@ 2023-04-17 13:38 ` Konrad Dybcio
2023-04-17 14:16 ` AngeloGioacchino Del Regno
0 siblings, 1 reply; 7+ messages in thread
From: Konrad Dybcio @ 2023-04-17 13:38 UTC (permalink / raw)
To: AngeloGioacchino Del Regno, neil.armstrong, Sam Ravnborg,
David Airlie, Daniel Vetter, AngeloGioacchino Del Regno
Cc: Marijn Suijten, dri-devel, linux-kernel
On 17.04.2023 11:44, AngeloGioacchino Del Regno wrote:
> Il 17/04/23 11:44, AngeloGioacchino Del Regno ha scritto:
>> Il 17/04/23 09:25, Neil Armstrong ha scritto:
>>> On 15/04/2023 13:00, Konrad Dybcio wrote:
>>>> 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 <konrad.dybcio@linaro.org>
>>>> ---
>>>> drivers/gpu/drm/panel/panel-novatek-nt35950.c | 8 +++++++-
>>>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>>>> index abf752b36a52..7498fc6258bb 100644
>>>> --- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>>>> +++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>>>> @@ -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) {
>>
>> If this is not a dual-DSI case, nt->dsi[1] will be NULL: I agree it's still
>> fine as in the kernel won't crash in that case, but for logical correctness
>> I would still account for that:
>>
>> if (num_dsis == 2)
>> mipi_dsi_device_unregister(nt->dsi[1]);
>>
>>>> + 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) {
>>
>> Same here, please add a check for num_dsis.
Right, I'll send an incremental patch to fix the fix, thanks
for spotting this!
Konrad
>>
>> Regards,
>> Angelo
>
> Eh, too late, I just noticed that this got picked already...
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] drm/panel: novatek-nt35950: Improve error handling
2023-04-17 13:38 ` Konrad Dybcio
@ 2023-04-17 14:16 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-04-17 14:16 UTC (permalink / raw)
To: Konrad Dybcio, neil.armstrong, Sam Ravnborg, David Airlie,
Daniel Vetter, AngeloGioacchino Del Regno
Cc: Marijn Suijten, dri-devel, linux-kernel
Il 17/04/23 15:38, Konrad Dybcio ha scritto:
>
>
> On 17.04.2023 11:44, AngeloGioacchino Del Regno wrote:
>> Il 17/04/23 11:44, AngeloGioacchino Del Regno ha scritto:
>>> Il 17/04/23 09:25, Neil Armstrong ha scritto:
>>>> On 15/04/2023 13:00, Konrad Dybcio wrote:
>>>>> 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 <konrad.dybcio@linaro.org>
>>>>> ---
>>>>> drivers/gpu/drm/panel/panel-novatek-nt35950.c | 8 +++++++-
>>>>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>>>>> index abf752b36a52..7498fc6258bb 100644
>>>>> --- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>>>>> +++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
>>>>> @@ -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) {
>>>
>>> If this is not a dual-DSI case, nt->dsi[1] will be NULL: I agree it's still
>>> fine as in the kernel won't crash in that case, but for logical correctness
>>> I would still account for that:
>>>
>>> if (num_dsis == 2)
>>> mipi_dsi_device_unregister(nt->dsi[1]);
>>>
>>>>> + 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) {
>>>
>>> Same here, please add a check for num_dsis.
> Right, I'll send an incremental patch to fix the fix, thanks
> for spotting this!
>
You're welcome! Please make sure to Cc me so that I can timely give you a review!
Cheers,
Angelo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/panel: novatek-nt35950: Improve error handling
2023-04-15 11:00 [PATCH] drm/panel: novatek-nt35950: Improve error handling Konrad Dybcio
2023-04-17 7:25 ` Neil Armstrong
@ 2023-04-17 7:28 ` Neil Armstrong
1 sibling, 0 replies; 7+ messages in thread
From: Neil Armstrong @ 2023-04-17 7:28 UTC (permalink / raw)
To: Sam Ravnborg, David Airlie, Daniel Vetter,
AngeloGioacchino Del Regno, AngeloGioacchino Del Regno,
Konrad Dybcio
Cc: Marijn Suijten, dri-devel, linux-kernel
Hi,
On Sat, 15 Apr 2023 13:00:30 +0200, Konrad Dybcio wrote:
> 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.
>
> [...]
Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next-fixes)
[1/1] drm/panel: novatek-nt35950: Improve error handling
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=5dd45b66742a1f3cfa9a92dc0ac8714c7708ee6c
--
Neil
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-04-17 14:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-15 11:00 [PATCH] drm/panel: novatek-nt35950: Improve error handling Konrad Dybcio
2023-04-17 7:25 ` Neil Armstrong
2023-04-17 9:44 ` AngeloGioacchino Del Regno
2023-04-17 9:44 ` AngeloGioacchino Del Regno
2023-04-17 13:38 ` Konrad Dybcio
2023-04-17 14:16 ` AngeloGioacchino Del Regno
2023-04-17 7:28 ` Neil Armstrong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®