dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: use ENOMEM for drmm_kzalloc allocation failures
@ 2022-05-21 23:41 Niels Dossche
  2022-05-25 15:39 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Niels Dossche @ 2022-05-21 23:41 UTC (permalink / raw)
  To: dri-devel; +Cc: Niels Dossche, Thomas Zimmermann, David Airlie

Other callers of drmm_kzalloc already return -ENOMEM on allocation
failure. Change EINVAL to ENOMEM for consistency.

Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
---

Note:
I found this issue using my experimental static analyser on Linux
5.17.9. I compile tested the patch on x86_64.

 drivers/gpu/drm/drm_encoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c
index 72e982323a5e..a940024c8087 100644
--- a/drivers/gpu/drm/drm_encoder.c
+++ b/drivers/gpu/drm/drm_encoder.c
@@ -226,7 +226,7 @@ void *__drmm_encoder_alloc(struct drm_device *dev, size_t size, size_t offset,
 
 	container = drmm_kzalloc(dev, size, GFP_KERNEL);
 	if (!container)
-		return ERR_PTR(-EINVAL);
+		return ERR_PTR(-ENOMEM);
 
 	encoder = container + offset;
 
-- 
2.36.0


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

* Re: [PATCH] drm: use ENOMEM for drmm_kzalloc allocation failures
  2022-05-21 23:41 [PATCH] drm: use ENOMEM for drmm_kzalloc allocation failures Niels Dossche
@ 2022-05-25 15:39 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2022-05-25 15:39 UTC (permalink / raw)
  To: Niels Dossche; +Cc: David Airlie, dri-devel, Thomas Zimmermann

On Sun, May 22, 2022 at 01:41:04AM +0200, Niels Dossche wrote:
> Other callers of drmm_kzalloc already return -ENOMEM on allocation
> failure. Change EINVAL to ENOMEM for consistency.
> 
> Signed-off-by: Niels Dossche <dossche.niels@gmail.com>

Thanks, applied to drm-misc-next.
-Daniel

> ---
> 
> Note:
> I found this issue using my experimental static analyser on Linux
> 5.17.9. I compile tested the patch on x86_64.
> 
>  drivers/gpu/drm/drm_encoder.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c
> index 72e982323a5e..a940024c8087 100644
> --- a/drivers/gpu/drm/drm_encoder.c
> +++ b/drivers/gpu/drm/drm_encoder.c
> @@ -226,7 +226,7 @@ void *__drmm_encoder_alloc(struct drm_device *dev, size_t size, size_t offset,
>  
>  	container = drmm_kzalloc(dev, size, GFP_KERNEL);
>  	if (!container)
> -		return ERR_PTR(-EINVAL);
> +		return ERR_PTR(-ENOMEM);
>  
>  	encoder = container + offset;
>  
> -- 
> 2.36.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

end of thread, other threads:[~2022-05-25 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-21 23:41 [PATCH] drm: use ENOMEM for drmm_kzalloc allocation failures Niels Dossche
2022-05-25 15:39 ` Daniel Vetter

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