From: Rob Herring Date: Fri, 19 Jul 2019 14:28:51 +0000 (-0600) Subject: drm/gem: Allow sparsely populated page arrays in drm_gem_put_pages X-Git-Tag: v5.4-rc1~32^2~17^2~47 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=930a402485b205214231f1141632afdca8ff89cb;p=platform%2Fkernel%2Flinux-rpi.git drm/gem: Allow sparsely populated page arrays in drm_gem_put_pages Panfrost has a need for pages allocated on demand via GPU page faults. When releasing the pages, the only thing preventing using drm_gem_put_pages() is needing to skip over unpopulated pages, so allow for skipping over NULL struct page pointers. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Reviewed-by: Steven Price Acked-by: Alyssa Rosenzweig Reviewed-by: Eric Anholt Signed-off-by: Rob Herring Link: https://patchwork.freedesktop.org/patch/msgid/20190808222200.13176-2-robh@kernel.org --- diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index afc38ce..a2dd198 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -633,6 +633,9 @@ void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, pagevec_init(&pvec); for (i = 0; i < npages; i++) { + if (!pages[i]) + continue; + if (dirty) set_page_dirty(pages[i]);