Skip to content

Commit

Permalink
drm/gem: Warn on trying to use a non-existing framebuffer plane
Browse files Browse the repository at this point in the history
Warn if callers of drm_gem_fb_get_obj() try to use a GEM buffer for
a non-existing or unset plane.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
  • Loading branch information
Thomas Zimmermann authored and intel-lab-lkp committed May 9, 2022
1 parent 83d0840 commit 74626e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/gpu/drm/drm_gem_framebuffer_helper.c
Expand Up @@ -53,7 +53,11 @@ MODULE_IMPORT_NS(DMA_BUF);
struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
unsigned int plane)
{
if (plane >= ARRAY_SIZE(fb->obj))
struct drm_device *dev = fb->dev;

if (drm_WARN_ON_ONCE(dev, plane >= ARRAY_SIZE(fb->obj)))
return NULL;
else if (drm_WARN_ON_ONCE(dev, !fb->obj[plane]))
return NULL;

return fb->obj[plane];
Expand Down

0 comments on commit 74626e0

Please sign in to comment.