diff mbox

[1/2] drm/i915: Assert all sg are initialised in fake_dma_object for selftests

Message ID 20170224201341.6249-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Feb. 24, 2017, 8:13 p.m. UTC
Double check that we allocated the right amount of scatterlist elements
for our obj->size.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
---
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Matthew Auld Feb. 25, 2017, 12:27 p.m. UTC | #1
On 24 February 2017 at 20:13, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Double check that we allocated the right amount of scatterlist elements
> for our obj->size.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.william.auld@gmail.com>
Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index 8e33a8bde78a..187444c37bbb 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -62,12 +62,14 @@  fake_get_pages(struct drm_i915_gem_object *obj)
 	for (sg = pages->sgl; sg; sg = sg_next(sg)) {
 		unsigned long len = min_t(typeof(rem), rem, BIT(31));
 
+		GEM_BUG_ON(!len);
 		sg_set_page(sg, pfn_to_page(PFN_BIAS), len, 0);
 		sg_dma_address(sg) = page_to_phys(sg_page(sg));
 		sg_dma_len(sg) = len;
 
 		rem -= len;
 	}
+	GEM_BUG_ON(rem);
 
 	obj->mm.madv = I915_MADV_DONTNEED;
 	return pages;