aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv
diff options
context:
space:
mode:
authorPaul Cassella <fortytwo-ivtv@manetheren.bigw.org>2011-02-08 20:22:52 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-21 19:32:33 -0400
commit793e71b667856ed6163ad0dc7de1f453e9385590 (patch)
treeefca87578eb126bca58129e55ee107c72cf63d51 /drivers/media/video/ivtv
parente45c2be9704381971d78d711e58dec35b1c4cf6f (diff)
[media] ivtv: udma: handle get_user_pages() returning fewer pages than 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>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r--drivers/media/video/ivtv/ivtv-udma.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/media/video/ivtv/ivtv-udma.c b/drivers/media/video/ivtv/ivtv-udma.c
index 1daf1dd65bf7..69cc8166b20b 100644
--- a/drivers/media/video/ivtv/ivtv-udma.c
+++ b/drivers/media/video/ivtv/ivtv-udma.c
@@ -132,7 +132,12 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
132 if (user_dma.page_count != err) { 132 if (user_dma.page_count != err) {
133 IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n", 133 IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n",
134 err, user_dma.page_count); 134 err, user_dma.page_count);
135 return -EINVAL; 135 if (err >= 0) {
136 for (i = 0; i < err; i++)
137 put_page(dma->map[i]);
138 return -EINVAL;
139 }
140 return err;
136 } 141 }
137 142
138 dma->page_count = user_dma.page_count; 143 dma->page_count = user_dma.page_count;