Commit 9a67bc4a authored by Anand K Mistry's avatar Anand K Mistry Committed by Chun-Kuang Hu

drm/mediatek: Stop iterating dma addresses when sg_dma_len() == 0

If dma_map_sg() merges pages when creating the mapping, only the first
entries will have a valid sg_dma_address() and sg_dma_len(), followed by
entries with sg_dma_len() == 0.
Signed-off-by: default avatarAnand K Mistry <amistry@google.com>
Signed-off-by: default avatarAnand K Mistry <amistry@chromium.org>
Signed-off-by: default avatarChun-Kuang Hu <chunkuang.hu@kernel.org>
parent 424a3a70
......@@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
expected = sg_dma_address(sg->sgl);
for_each_sg(sg->sgl, s, sg->nents, i) {
if (!sg_dma_len(s))
break;
if (sg_dma_address(s) != expected) {
DRM_ERROR("sg_table is not contiguous");
ret = -EINVAL;
......
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