Since we already have that warning inside `remap_sg` we can also catch this condition inside `remap_io_sg`. Signed-off-by: Krzysztof Karas <krzysztof.karas@xxxxxxxxx> --- drivers/gpu/drm/i915/i915_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_mm.c b/drivers/gpu/drm/i915/i915_mm.c index f5c97a620962..8a2779191f18 100644 --- a/drivers/gpu/drm/i915/i915_mm.c +++ b/drivers/gpu/drm/i915/i915_mm.c @@ -146,7 +146,7 @@ int remap_io_sg(struct vm_area_struct *vma, while (offset >= sg_dma_len(r.sgt.sgp) >> PAGE_SHIFT) { offset -= sg_dma_len(r.sgt.sgp) >> PAGE_SHIFT; r.sgt = __sgt_iter(__sg_next(r.sgt.sgp), use_dma(iobase)); - if (!r.sgt.sgp) + if (GEM_WARN_ON(!r.sgt.sgp)) return -EINVAL; } r.sgt.curr = offset << PAGE_SHIFT; -- 2.43.0