Commit e0b3d214 authored by Daniel Vetter's avatar Daniel Vetter

drm/gem: WARN if drm_gem_get_pages is called on a private obj

No real functional change, since this just converts an annoying Oops
into a more harmless WARNING backtrace. It's still a driver bug.
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Tested-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200511093554.211493-3-daniel.vetter@ffwll.ch
parent 8b6b7d84
...@@ -548,6 +548,10 @@ static void drm_gem_check_release_pagevec(struct pagevec *pvec) ...@@ -548,6 +548,10 @@ static void drm_gem_check_release_pagevec(struct pagevec *pvec)
* set during initialization. If you have special zone constraints, set them * set during initialization. If you have special zone constraints, set them
* after drm_gem_object_init() via mapping_set_gfp_mask(). shmem-core takes care * after drm_gem_object_init() via mapping_set_gfp_mask(). shmem-core takes care
* to keep pages in the required zone during swap-in. * to keep pages in the required zone during swap-in.
*
* This function is only valid on objects initialized with
* drm_gem_object_init(), but not for those initialized with
* drm_gem_private_object_init() only.
*/ */
struct page **drm_gem_get_pages(struct drm_gem_object *obj) struct page **drm_gem_get_pages(struct drm_gem_object *obj)
{ {
...@@ -556,6 +560,10 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj) ...@@ -556,6 +560,10 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj)
struct pagevec pvec; struct pagevec pvec;
int i, npages; int i, npages;
if (WARN_ON(!obj->filp))
return ERR_PTR(-EINVAL);
/* This is the shared memory object that backs the GEM resource */ /* This is the shared memory object that backs the GEM resource */
mapping = obj->filp->f_mapping; mapping = obj->filp->f_mapping;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment