drm: use ENOMEM for drmm_kzalloc allocation failures
Subsystems (2)
PATCH 1/1 drm: use ENOMEM for drmm_kzalloc allocation failures
Other callers of drmm_kzalloc already return -ENOMEM on allocation failure. Change EINVAL to ENOMEM for consistency.
Signed-off-by Niels Dossche <[email protected]>
---
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(-)
drivers/gpu/drm/drm_encoder.c +1 -1
@@ -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;
Signature · 1 line
2.36.0
Daniel Vetter
AppliedQuoted 4 lines · Niels Dossche
Other callers of
drmm_kzallocalready return-ENOMEMon allocation failure. Change EINVAL to ENOMEM for consistency.Signed-off-by Niels Dossche <[email protected]>
Thanks, applied to drm-misc-next.
-Daniel
Quoted 25 lines
---
Note:
I found this issue using my experimental static analyser on Linux 5.17.9. I compile tested the patch onx86_64.drivers/gpu/drm/drm_encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_encoder.c +1
-1@@ -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;Signature · 1 line
2.36.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch