diff mbox series

drm/panthor: Fix a couple -ENOMEM error codes

Message ID cf5bbba5-427e-4940-b91e-925f9fa71f8d@moroto.mountain (mailing list archive)
State New, archived
Headers show
Series drm/panthor: Fix a couple -ENOMEM error codes | expand

Commit Message

Dan Carpenter April 2, 2024, 9:58 a.m. UTC
These error paths forgot to set the error code to -ENOMEM.

Fixes: 647810ec2476 ("drm/panthor: Add the MMU/VM logical block")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/panthor/panthor_mmu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Boris Brezillon April 2, 2024, 12:21 p.m. UTC | #1
On Tue, 2 Apr 2024 12:58:09 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:

> These error paths forgot to set the error code to -ENOMEM.
> 
> Fixes: 647810ec2476 ("drm/panthor: Add the MMU/VM logical block")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

> ---
>  drivers/gpu/drm/panthor/panthor_mmu.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> index fdd35249169f..a26b40aab261 100644
> --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> @@ -1264,8 +1264,10 @@ static int panthor_vm_prepare_map_op_ctx(struct panthor_vm_op_ctx *op_ctx,
>  	op_ctx->rsvd_page_tables.pages = kcalloc(pt_count,
>  						 sizeof(*op_ctx->rsvd_page_tables.pages),
>  						 GFP_KERNEL);
> -	if (!op_ctx->rsvd_page_tables.pages)
> +	if (!op_ctx->rsvd_page_tables.pages) {
> +		ret = -ENOMEM;
>  		goto err_cleanup;
> +	}
>  
>  	ret = kmem_cache_alloc_bulk(pt_cache, GFP_KERNEL, pt_count,
>  				    op_ctx->rsvd_page_tables.pages);
> @@ -1318,8 +1320,10 @@ static int panthor_vm_prepare_unmap_op_ctx(struct panthor_vm_op_ctx *op_ctx,
>  		op_ctx->rsvd_page_tables.pages = kcalloc(pt_count,
>  							 sizeof(*op_ctx->rsvd_page_tables.pages),
>  							 GFP_KERNEL);
> -		if (!op_ctx->rsvd_page_tables.pages)
> +		if (!op_ctx->rsvd_page_tables.pages) {
> +			ret = -ENOMEM;
>  			goto err_cleanup;
> +		}
>  
>  		ret = kmem_cache_alloc_bulk(pt_cache, GFP_KERNEL, pt_count,
>  					    op_ctx->rsvd_page_tables.pages);
Boris Brezillon April 3, 2024, 7:16 a.m. UTC | #2
On Tue, 2 Apr 2024 12:58:09 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:

> These error paths forgot to set the error code to -ENOMEM.
> 
> Fixes: 647810ec2476 ("drm/panthor: Add the MMU/VM logical block")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Queued to drm-misc-next.

Thanks,

Boris

> ---
>  drivers/gpu/drm/panthor/panthor_mmu.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> index fdd35249169f..a26b40aab261 100644
> --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> @@ -1264,8 +1264,10 @@ static int panthor_vm_prepare_map_op_ctx(struct panthor_vm_op_ctx *op_ctx,
>  	op_ctx->rsvd_page_tables.pages = kcalloc(pt_count,
>  						 sizeof(*op_ctx->rsvd_page_tables.pages),
>  						 GFP_KERNEL);
> -	if (!op_ctx->rsvd_page_tables.pages)
> +	if (!op_ctx->rsvd_page_tables.pages) {
> +		ret = -ENOMEM;
>  		goto err_cleanup;
> +	}
>  
>  	ret = kmem_cache_alloc_bulk(pt_cache, GFP_KERNEL, pt_count,
>  				    op_ctx->rsvd_page_tables.pages);
> @@ -1318,8 +1320,10 @@ static int panthor_vm_prepare_unmap_op_ctx(struct panthor_vm_op_ctx *op_ctx,
>  		op_ctx->rsvd_page_tables.pages = kcalloc(pt_count,
>  							 sizeof(*op_ctx->rsvd_page_tables.pages),
>  							 GFP_KERNEL);
> -		if (!op_ctx->rsvd_page_tables.pages)
> +		if (!op_ctx->rsvd_page_tables.pages) {
> +			ret = -ENOMEM;
>  			goto err_cleanup;
> +		}
>  
>  		ret = kmem_cache_alloc_bulk(pt_cache, GFP_KERNEL, pt_count,
>  					    op_ctx->rsvd_page_tables.pages);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
index fdd35249169f..a26b40aab261 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -1264,8 +1264,10 @@  static int panthor_vm_prepare_map_op_ctx(struct panthor_vm_op_ctx *op_ctx,
 	op_ctx->rsvd_page_tables.pages = kcalloc(pt_count,
 						 sizeof(*op_ctx->rsvd_page_tables.pages),
 						 GFP_KERNEL);
-	if (!op_ctx->rsvd_page_tables.pages)
+	if (!op_ctx->rsvd_page_tables.pages) {
+		ret = -ENOMEM;
 		goto err_cleanup;
+	}
 
 	ret = kmem_cache_alloc_bulk(pt_cache, GFP_KERNEL, pt_count,
 				    op_ctx->rsvd_page_tables.pages);
@@ -1318,8 +1320,10 @@  static int panthor_vm_prepare_unmap_op_ctx(struct panthor_vm_op_ctx *op_ctx,
 		op_ctx->rsvd_page_tables.pages = kcalloc(pt_count,
 							 sizeof(*op_ctx->rsvd_page_tables.pages),
 							 GFP_KERNEL);
-		if (!op_ctx->rsvd_page_tables.pages)
+		if (!op_ctx->rsvd_page_tables.pages) {
+			ret = -ENOMEM;
 			goto err_cleanup;
+		}
 
 		ret = kmem_cache_alloc_bulk(pt_cache, GFP_KERNEL, pt_count,
 					    op_ctx->rsvd_page_tables.pages);