diff mbox

[1/2] V4L/DVB: buf-dma-sg.c: don't assume nr_pages == sglen

Message ID 1267718451-24961-2-git-send-email-arnout@mind.be (mailing list archive)
State Superseded
Headers show

Commit Message

Arnout Vandecappelle March 4, 2010, 4 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
index da1790e..3b6f1b8 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -244,7 +244,7 @@  int videobuf_dma_map(struct videobuf_queue* q, struct videobuf_dmabuf *dma)
 	}
 	if (!dma->bus_addr) {
 		dma->sglen = dma_map_sg(q->dev, dma->sglist,
-					dma->nr_pages, dma->direction);
+					dma->sglen, dma->direction);
 		if (0 == dma->sglen) {
 			printk(KERN_WARNING
 			       "%s: videobuf_map_sg failed\n",__func__);
@@ -262,7 +262,7 @@  int videobuf_dma_sync(struct videobuf_queue *q, struct videobuf_dmabuf *dma)
 	MAGIC_CHECK(dma->magic, MAGIC_DMABUF);
 	BUG_ON(!dma->sglen);
 
-	dma_sync_sg_for_cpu(q->dev, dma->sglist, dma->nr_pages, dma->direction);
+	dma_sync_sg_for_cpu(q->dev, dma->sglist, dma->sglen, dma->direction);
 	return 0;
 }
 
@@ -272,7 +272,7 @@  int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma)
 	if (!dma->sglen)
 		return 0;
 
-	dma_unmap_sg(q->dev, dma->sglist, dma->nr_pages, dma->direction);
+	dma_unmap_sg(q->dev, dma->sglist, dma->sglen, dma->direction);
 
 	kfree(dma->sglist);
 	dma->sglist = NULL;