[Intel-gfx] [PATCH] drm/i915: permit zero valued dmap in for_each_sgt_dma

Matthew Auld matthew.auld at intel.com
Wed Jan 30 19:18:25 UTC 2019


Break on NULL iter.sgp, rather than dmap == 0, on the off chance that we
have some hypothetical selftest or similar in the future that considers
dmap = 0 to be perfectly valid.

Signed-off-by: Matthew Auld <matthew.auld at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index d072f3369ee1..04f102d5bbe9 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2181,7 +2181,7 @@ static inline struct scatterlist *__sg_next(struct scatterlist *sg)
  */
 #define for_each_sgt_dma(__dmap, __iter, __sgt)				\
 	for ((__iter) = __sgt_iter((__sgt)->sgl, true);			\
-	     ((__dmap) = (__iter).dma + (__iter).curr);			\
+	     ((__dmap) = (__iter).dma + (__iter).curr), (__iter).sgp;   \
 	     (((__iter).curr += I915_GTT_PAGE_SIZE) >= (__iter).max) ?	\
 	     (__iter) = __sgt_iter(__sg_next((__iter).sgp), true), 0 : 0)
 
-- 
2.20.1



More information about the Intel-gfx mailing list