Skip to content

Commit 9a67bc4

Browse files
akmistryChun-Kuang Hu
authored andcommitted
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: Anand K Mistry <[email protected]> Signed-off-by: Anand K Mistry <[email protected]> Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent 424a3a7 commit 9a67bc4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/gpu/drm/mediatek/mtk_drm_gem.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
224224

225225
expected = sg_dma_address(sg->sgl);
226226
for_each_sg(sg->sgl, s, sg->nents, i) {
227+
if (!sg_dma_len(s))
228+
break;
229+
227230
if (sg_dma_address(s) != expected) {
228231
DRM_ERROR("sg_table is not contiguous");
229232
ret = -EINVAL;

0 commit comments

Comments
 (0)