On Sat, 2011-02-05 at 22:36 -0800, Paul Cassella wrote:
> From: Paul Cassella <[email protected]>
> 
> get_user_pages() may return fewer page than we ask for.  As we give up and
> return an error in this case, we need to put_page() each of the pages we
> did get.
> 
> Signed-off-by: Paul Cassella <[email protected]>

Looks good.
I removed the braces in the 'for' statement to eliminate a checkpatch.pl
warning,

Signed-off-by: Andy Walls <[email protected]>

Your first two patches are queued up here:

http://git.linuxtv.org/awalls/media_tree.git?a=shortlog;h=refs/heads/ivtv_39


> ---
> I'm running with this on 2.6.37, though haven't triggered the condition.  
> This patch is against staging/for_v2.6.39, which compiles cleanly with it.
> 
> I'm not sure -EINVAL is the best return code vs -EFAULT or -ENOMEM, but 
> this mod doesn't change it.

It doesn't matter.  The only caller of ivtv_udma_setup() doesn't care
about the exact value of an error return; it substitutes -EIO.

Regards,
Andy


>  drivers/media/video/ivtv/ivtv-udma.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/media/video/ivtv/ivtv-udma.c 
> b/drivers/media/video/ivtv/ivtv-udma.c
> index 1daf1dd..443ca35 100644
> --- a/drivers/media/video/ivtv/ivtv-udma.c
> +++ b/drivers/media/video/ivtv/ivtv-udma.c
> @@ -132,7 +132,13 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long 
> ivtv_dest_addr,
>       if (user_dma.page_count != err) {
>               IVTV_DEBUG_WARN("failed to map user pages, returned %d instead 
> of %d\n",
>                          err, user_dma.page_count);
> -             return -EINVAL;
> +             if (err >= 0) {
> +                     for (i = 0; i < err; i++) {
> +                             put_page(dma->map[i]);
> +                     }
> +                     return -EINVAL;
> +             }
> +             return err;
>       }
>  
>       dma->page_count = user_dma.page_count;



_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel

Reply via email to