aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-08-19 16:56:41 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:05:48 -0400
commit8beb058f1ecde7bc0554d18ce1baa18b5dfb02d3 (patch)
tree0ac375d2d009baca2d39ffae97734d04b167872d
parent25e3f8f40ecf61b87a4b6476ea6d00cb5b74628c (diff)
V4L/DVB (6060): ivtv: fix IVTV_IOC_DMA_FRAME bug introduced by highmem bugfix
The return value of ivtv_udma_fill_sg_list() was changed by the highmem bugfix, but that return value was still used in ivtv-yuv.c. Revert to the old return value, but in addition return -1 in case of a memory allocation error. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/ivtv/ivtv-udma.c12
-rw-r--r--drivers/media/video/ivtv/ivtv-yuv.c2
2 files changed, 8 insertions, 6 deletions
diff --git a/drivers/media/video/ivtv/ivtv-udma.c b/drivers/media/video/ivtv/ivtv-udma.c
index 5592abbe14e6..7e503adacea0 100644
--- a/drivers/media/video/ivtv/ivtv-udma.c
+++ b/drivers/media/video/ivtv/ivtv-udma.c
@@ -40,6 +40,9 @@ int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info
40 int i, offset; 40 int i, offset;
41 unsigned long flags; 41 unsigned long flags;
42 42
43 if (map_offset < 0)
44 return map_offset;
45
43 offset = dma_page->offset; 46 offset = dma_page->offset;
44 47
45 /* Fill SG Array with new values */ 48 /* Fill SG Array with new values */
@@ -55,7 +58,7 @@ int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info
55 if (dma->bouncemap[map_offset] == NULL) 58 if (dma->bouncemap[map_offset] == NULL)
56 dma->bouncemap[map_offset] = alloc_page(GFP_KERNEL); 59 dma->bouncemap[map_offset] = alloc_page(GFP_KERNEL);
57 if (dma->bouncemap[map_offset] == NULL) 60 if (dma->bouncemap[map_offset] == NULL)
58 return -ENOMEM; 61 return -1;
59 local_irq_save(flags); 62 local_irq_save(flags);
60 src = kmap_atomic(dma->map[map_offset], KM_BOUNCE_READ) + offset; 63 src = kmap_atomic(dma->map[map_offset], KM_BOUNCE_READ) + offset;
61 memcpy(page_address(dma->bouncemap[map_offset]) + offset, src, len); 64 memcpy(page_address(dma->bouncemap[map_offset]) + offset, src, len);
@@ -69,7 +72,7 @@ int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info
69 offset = 0; 72 offset = 0;
70 map_offset++; 73 map_offset++;
71 } 74 }
72 return 0; 75 return map_offset;
73} 76}
74 77
75void ivtv_udma_fill_sg_array (struct ivtv_user_dma *dma, u32 buffer_offset, u32 buffer_offset_2, u32 split) { 78void ivtv_udma_fill_sg_array (struct ivtv_user_dma *dma, u32 buffer_offset, u32 buffer_offset_2, u32 split) {
@@ -138,13 +141,12 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
138 dma->page_count = user_dma.page_count; 141 dma->page_count = user_dma.page_count;
139 142
140 /* Fill SG List with new values */ 143 /* Fill SG List with new values */
141 err = ivtv_udma_fill_sg_list(dma, &user_dma, 0); 144 if (ivtv_udma_fill_sg_list(dma, &user_dma, 0) < 0) {
142 if (err) {
143 for (i = 0; i < dma->page_count; i++) { 145 for (i = 0; i < dma->page_count; i++) {
144 put_page(dma->map[i]); 146 put_page(dma->map[i]);
145 } 147 }
146 dma->page_count = 0; 148 dma->page_count = 0;
147 return err; 149 return -ENOMEM;
148 } 150 }
149 151
150 /* Map SG List */ 152 /* Map SG List */
diff --git a/drivers/media/video/ivtv/ivtv-yuv.c b/drivers/media/video/ivtv/ivtv-yuv.c
index 2ae7556f5e68..1922c1da20d3 100644
--- a/drivers/media/video/ivtv/ivtv-yuv.c
+++ b/drivers/media/video/ivtv/ivtv-yuv.c
@@ -83,7 +83,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
83 } 83 }
84 84
85 /* Fill & map SG List */ 85 /* Fill & map SG List */
86 if (ivtv_udma_fill_sg_list (dma, &uv_dma, ivtv_udma_fill_sg_list (dma, &y_dma, 0))) { 86 if (ivtv_udma_fill_sg_list (dma, &uv_dma, ivtv_udma_fill_sg_list (dma, &y_dma, 0)) < 0) {
87 IVTV_DEBUG_WARN("could not allocate bounce buffers for highmem userspace buffers\n"); 87 IVTV_DEBUG_WARN("could not allocate bounce buffers for highmem userspace buffers\n");
88 for (i = 0; i < dma->page_count; i++) { 88 for (i = 0; i < dma->page_count; i++) {
89 put_page(dma->map[i]); 89 put_page(dma->map[i]);