2024-01-06 17:04:07

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH] drm/stm: Fix an error handling path in stm_drm_platform_probe()

If drm_dev_register() fails, a call to drv_load() must be undone, as
already done in the remove function.

Fixes: b759012c5fa7 ("drm/stm: Add STM32 LTDC driver")
Signed-off-by: Christophe JAILLET <[email protected]>
---
This was already sent a few years ago in [1] but it got no response.
Since, there has been some activity on this driver, so I send it again.

Note that it is untested.

[1]: https://lore.kernel.org/all/[email protected]/
---
drivers/gpu/drm/stm/drv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index e8523abef27a..4d2db079ad4f 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -203,12 +203,14 @@ static int stm_drm_platform_probe(struct platform_device *pdev)

ret = drm_dev_register(ddev, 0);
if (ret)
- goto err_put;
+ goto err_unload;

drm_fbdev_dma_setup(ddev, 16);

return 0;

+err_unload:
+ drv_unload(ddev);
err_put:
drm_dev_put(ddev);

--
2.34.1



2024-01-10 09:55:30

by Raphael Gallais-Pou

[permalink] [raw]
Subject: Re: [PATCH] drm/stm: Fix an error handling path in stm_drm_platform_probe()

Hi Christophe,

On 1/6/24 17:54, Christophe JAILLET wrote:
> If drm_dev_register() fails, a call to drv_load() must be undone, as
> already done in the remove function.
>
> Fixes: b759012c5fa7 ("drm/stm: Add STM32 LTDC driver")
> Signed-off-by: Christophe JAILLET <[email protected]>
> ---
> This was already sent a few years ago in [1] but it got no response.
> Since, there has been some activity on this driver, so I send it again.
>
> Note that it is untested.
>
> [1]: https://lore.kernel.org/all/[email protected]/
> ---
> drivers/gpu/drm/stm/drv.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
I tested it against stm32mp157c-dk2.dts.

Thanks for your submission.

Acked-by: Raphael Gallais-Pou <[email protected]>


Regards,

Raphaƫl Gallais-Pou