linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH next] drm/xe: Fix an IS_ERR() vs NULL bug in xe_tile_alloc_vram()
@ 2025-07-18 21:23 Dan Carpenter
  2025-07-21 14:40 ` Rodrigo Vivi
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-07-18 21:23 UTC (permalink / raw)
  To: Piotr Piórkowski
  Cc: Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
	David Airlie, Simona Vetter, Matthew Brost, Matthew Auld,
	intel-xe, dri-devel, linux-kernel, kernel-janitors

The xe_vram_region_alloc() function returns NULL on error.  It never
returns error pointers.  Update the error checking to match.

Fixes: 4b0a5f5ce784 ("drm/xe: Unify the initialization of VRAM regions")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/xe/xe_tile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_tile.c b/drivers/gpu/drm/xe/xe_tile.c
index 0be0a5c57ef4..d49ba3401963 100644
--- a/drivers/gpu/drm/xe/xe_tile.c
+++ b/drivers/gpu/drm/xe/xe_tile.c
@@ -120,8 +120,8 @@ int xe_tile_alloc_vram(struct xe_tile *tile)
 		return 0;
 
 	vram = xe_vram_region_alloc(xe, tile->id, XE_PL_VRAM0 + tile->id);
-	if (IS_ERR(vram))
-		return PTR_ERR(vram);
+	if (!vram)
+		return -ENOMEM;
 	tile->mem.vram = vram;
 
 	return 0;
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH next] drm/xe: Fix an IS_ERR() vs NULL bug in xe_tile_alloc_vram()
  2025-07-18 21:23 [PATCH next] drm/xe: Fix an IS_ERR() vs NULL bug in xe_tile_alloc_vram() Dan Carpenter
@ 2025-07-21 14:40 ` Rodrigo Vivi
  0 siblings, 0 replies; 2+ messages in thread
From: Rodrigo Vivi @ 2025-07-21 14:40 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Piotr Piórkowski, Lucas De Marchi, Thomas Hellström,
	David Airlie, Simona Vetter, Matthew Brost, Matthew Auld,
	intel-xe, dri-devel, linux-kernel, kernel-janitors

On Fri, Jul 18, 2025 at 04:23:05PM -0500, Dan Carpenter wrote:
> The xe_vram_region_alloc() function returns NULL on error.  It never
> returns error pointers.  Update the error checking to match.
> 
> Fixes: 4b0a5f5ce784 ("drm/xe: Unify the initialization of VRAM regions")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/gpu/drm/xe/xe_tile.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_tile.c b/drivers/gpu/drm/xe/xe_tile.c
> index 0be0a5c57ef4..d49ba3401963 100644
> --- a/drivers/gpu/drm/xe/xe_tile.c
> +++ b/drivers/gpu/drm/xe/xe_tile.c
> @@ -120,8 +120,8 @@ int xe_tile_alloc_vram(struct xe_tile *tile)
>  		return 0;
>  
>  	vram = xe_vram_region_alloc(xe, tile->id, XE_PL_VRAM0 + tile->id);
> -	if (IS_ERR(vram))
> -		return PTR_ERR(vram);
> +	if (!vram)
> +		return -ENOMEM;

Indeed correct, from the drmm_kmalloc to the probe where it is consumed.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

and pushed to drm-xe-next

>  	tile->mem.vram = vram;
>  
>  	return 0;
> -- 
> 2.47.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-21 14:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-18 21:23 [PATCH next] drm/xe: Fix an IS_ERR() vs NULL bug in xe_tile_alloc_vram() Dan Carpenter
2025-07-21 14:40 ` Rodrigo Vivi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).