Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: fb: cma: Fail gracefully on allocation failure

The drm_gem_cma_create() function never returns NULL but rather an error
encoded in the return value using the ERR_PTR() macro. Callers therefore
need to check for errors using the IS_ERR() macro. This change allows
drivers to handle contiguous DMA allocation failures gracefully.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Thierry Reding and committed by
Dave Airlie
02813245 e0d78d08

+1 -1
+1 -1
drivers/gpu/drm/drm_fb_cma_helper.c
··· 220 220 221 221 size = mode_cmd.pitches[0] * mode_cmd.height; 222 222 obj = drm_gem_cma_create(dev, size); 223 - if (!obj) 223 + if (IS_ERR(obj)) 224 224 return -ENOMEM; 225 225 226 226 fbi = framebuffer_alloc(0, dev->dev);