Skip to content

Commit

Permalink
drm: fb: cma: Fail gracefully on allocation failure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thierry Reding authored and Dave Airlie committed Oct 23, 2012
1 parent e0d78d0 commit 0281324
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_fb_cma_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper,

size = mode_cmd.pitches[0] * mode_cmd.height;
obj = drm_gem_cma_create(dev, size);
if (!obj)
if (IS_ERR(obj))
return -ENOMEM;

fbi = framebuffer_alloc(0, dev->dev);
Expand Down

0 comments on commit 0281324

Please sign in to comment.