Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8beb058f1ecde7bc0554d18ce1baa18b5dfb02d3
Commit:     8beb058f1ecde7bc0554d18ce1baa18b5dfb02d3
Parent:     25e3f8f40ecf61b87a4b6476ea6d00cb5b74628c
Author:     Hans Verkuil <[EMAIL PROTECTED]>
AuthorDate: Sun Aug 19 17:56:41 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Tue Oct 9 22:05:48 2007 -0300

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/ivtv/ivtv-udma.c |   12 +++++++-----
 drivers/media/video/ivtv/ivtv-yuv.c  |    2 +-
 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 5592abb..7e503ad 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
        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 */
diff --git a/drivers/media/video/ivtv/ivtv-yuv.c 
b/drivers/media/video/ivtv/ivtv-yuv.c
index 2ae7556..1922c1d 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,
        }
 
        /* Fill & map SG List */
-       if (ivtv_udma_fill_sg_list (dma, &uv_dma, ivtv_udma_fill_sg_list (dma, 
&y_dma, 0))) {
+       if (ivtv_udma_fill_sg_list (dma, &uv_dma, ivtv_udma_fill_sg_list (dma, 
&y_dma, 0)) < 0) {
                IVTV_DEBUG_WARN("could not allocate bounce buffers for highmem 
userspace buffers\n");
                for (i = 0; i < dma->page_count; i++) {
                        put_page(dma->map[i]);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to