summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/ivtv/ivtv-udma.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-08-19 22:56:41 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2007-08-19 22:56:41 +0200
commit8a6d57d665385ce55fc31b961e424185ecd3b4ae (patch)
tree71ea330ec3585dc60de03e0839eba95658f403bb /linux/drivers/media/video/ivtv/ivtv-udma.c
parentc6335006c82d58c81b020a32abd2570a5e667d07 (diff)
downloadmediapointer-dvb-s2-8a6d57d665385ce55fc31b961e424185ecd3b4ae.tar.gz
mediapointer-dvb-s2-8a6d57d665385ce55fc31b961e424185ecd3b4ae.tar.bz2
ivtv: fix IVTV_IOC_DMA_FRAME bug introduced by highmem bugfix.
From: Hans Verkuil <hverkuil@xs4all.nl> 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>
Diffstat (limited to 'linux/drivers/media/video/ivtv/ivtv-udma.c')
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-udma.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/linux/drivers/media/video/ivtv/ivtv-udma.c b/linux/drivers/media/video/ivtv/ivtv-udma.c
index 5592abbe1..7e503adac 100644
--- a/linux/drivers/media/video/ivtv/ivtv-udma.c
+++ b/linux/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
int i, offset;
unsigned long flags;
+ if (map_offset < 0)
+ return map_offset;
+
offset = dma_page->offset;
/* 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
if (dma->bouncemap[map_offset] == NULL)
dma->bouncemap[map_offset] = alloc_page(GFP_KERNEL);
if (dma->bouncemap[map_offset] == NULL)
- return -ENOMEM;
+ return -1;
local_irq_save(flags);
src = kmap_atomic(dma->map[map_offset], KM_BOUNCE_READ) + offset;
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
offset = 0;
map_offset++;
}
- return 0;
+ return map_offset;
}
void 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,
dma->page_count = user_dma.page_count;
/* Fill SG List with new values */
- err = ivtv_udma_fill_sg_list(dma, &user_dma, 0);
- if (err) {
+ if (ivtv_udma_fill_sg_list(dma, &user_dma, 0) < 0) {
for (i = 0; i < dma->page_count; i++) {
put_page(dma->map[i]);
}
dma->page_count = 0;
- return err;
+ return -ENOMEM;
}
/* Map SG List */