diff mbox series

[1/5] drm/v3d: Fix return if scheduler initialization fails

Message ID 20240311100959.205545-2-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series drm/v3d: Enable Super Pages | expand

Commit Message

Maíra Canal March 11, 2024, 10:05 a.m. UTC
If the scheduler initialization fails, GEM initialization must fail as
well. Therefore, if `v3d_sched_init()` fails, free the DMA memory
allocated and return the error value in `v3d_gem_init()`.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 drivers/gpu/drm/v3d/v3d_gem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.43.0

Comments

Iago Toral March 12, 2024, 8:35 a.m. UTC | #1
This patch is: Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>

Iago

El lun, 11-03-2024 a las 07:05 -0300, Maíra Canal escribió:
> If the scheduler initialization fails, GEM initialization must fail
> as
> well. Therefore, if `v3d_sched_init()` fails, free the DMA memory
> allocated and return the error value in `v3d_gem_init()`.
> 
> Signed-off-by: Maíra Canal <mcanal@igalia.com>
> ---
>  drivers/gpu/drm/v3d/v3d_gem.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_gem.c
> b/drivers/gpu/drm/v3d/v3d_gem.c
> index afc565078c78..66f4b78a6b2e 100644
> --- a/drivers/gpu/drm/v3d/v3d_gem.c
> +++ b/drivers/gpu/drm/v3d/v3d_gem.c
> @@ -290,8 +290,9 @@ v3d_gem_init(struct drm_device *dev)
>  	ret = v3d_sched_init(v3d);
>  	if (ret) {
>  		drm_mm_takedown(&v3d->mm);
> -		dma_free_coherent(v3d->drm.dev, 4096 * 1024, (void
> *)v3d->pt,
> +		dma_free_coherent(v3d->drm.dev, pt_size, (void
> *)v3d->pt,
>  				  v3d->pt_paddr);
> +		return ret;
>  	}
> 
>  	return 0;
> --
> 2.43.0
> 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
index afc565078c78..66f4b78a6b2e 100644
--- a/drivers/gpu/drm/v3d/v3d_gem.c
+++ b/drivers/gpu/drm/v3d/v3d_gem.c
@@ -290,8 +290,9 @@  v3d_gem_init(struct drm_device *dev)
 	ret = v3d_sched_init(v3d);
 	if (ret) {
 		drm_mm_takedown(&v3d->mm);
-		dma_free_coherent(v3d->drm.dev, 4096 * 1024, (void *)v3d->pt,
+		dma_free_coherent(v3d->drm.dev, pt_size, (void *)v3d->pt,
 				  v3d->pt_paddr);
+		return ret;
 	}

 	return 0;