Skip to content

Commit 7f83064

Browse files
rmurphy-armtorvalds
authored andcommitted
dma-debug: check nents in dma_sync_sg*
Like dma_unmap_sg, dma_sync_sg* should be called with the original number of entries passed to dma_map_sg, so do the same check in the sync path as we do in the unmap path. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Sakari Ailus <sakari.ailus@iki.fi> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 002edb6 commit 7f83064

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/dma-debug.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,14 @@ static void check_sync(struct device *dev,
12491249
dir2name[entry->direction],
12501250
dir2name[ref->direction]);
12511251

1252+
if (ref->sg_call_ents && ref->type == dma_debug_sg &&
1253+
ref->sg_call_ents != entry->sg_call_ents) {
1254+
err_printk(ref->dev, entry, "DMA-API: device driver syncs "
1255+
"DMA sg list with different entry count "
1256+
"[map count=%d] [sync count=%d]\n",
1257+
entry->sg_call_ents, ref->sg_call_ents);
1258+
}
1259+
12521260
out:
12531261
put_hash_bucket(bucket, &flags);
12541262
}

0 commit comments

Comments
 (0)