diff mbox series

drm/stm: Fix an error handling path in stm_drm_platform_probe()

Message ID 20fff7f853f20a48a96db8ff186124470ec4d976.1704560028.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State New, archived
Headers show
Series drm/stm: Fix an error handling path in stm_drm_platform_probe() | expand

Commit Message

Christophe JAILLET Jan. 6, 2024, 4:54 p.m. UTC
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 <christophe.jaillet@wanadoo.fr>
---
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/20200501125511.132029-1-christophe.jaillet@wanadoo.fr/
---
 drivers/gpu/drm/stm/drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Raphael Gallais-Pou Jan. 10, 2024, 9:54 a.m. UTC | #1
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 <christophe.jaillet@wanadoo.fr>
> ---
> 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/20200501125511.132029-1-christophe.jaillet@wanadoo.fr/
> ---
>  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 <raphael.gallais-pou@foss.st.com>


Regards,

Raphaël Gallais-Pou
Raphael Gallais-Pou July 9, 2024, 8:28 a.m. UTC | #2
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 <christophe.jaillet@wanadoo.fr>


Hi Christophe,

After some delay: applied on drm-misc-next.

Thanks,
Raphaël
diff mbox series

Patch

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);