Skip to content

Commit

Permalink
[media] ivtv: udma: handle get_user_pages() returning fewer pages tha…
Browse files Browse the repository at this point in the history
…n we asked for

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.

[Andy Walls modified the patch, only removing the braces in the 'for'
statement, to eliminate a checkpatch warning.]

Signed-off-by: Paul Cassella <fortytwo-ivtv@manetheren.bigw.org>
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Paul Cassella authored and Mauro Carvalho Chehab committed Mar 21, 2011
1 parent e45c2be commit 793e71b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/media/video/ivtv/ivtv-udma.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ 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;
Expand Down

0 comments on commit 793e71b

Please sign in to comment.