Commit 793e71b6 authored by Paul Cassella's avatar Paul Cassella Committed by Mauro Carvalho Chehab

[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: default avatarPaul Cassella <fortytwo-ivtv@manetheren.bigw.org>
Signed-off-by: default avatarAndy Walls <awalls@md.metrocast.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e45c2be9
...@@ -132,7 +132,12 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, ...@@ -132,7 +132,12 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
if (user_dma.page_count != err) { if (user_dma.page_count != err) {
IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n", IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n",
err, user_dma.page_count); 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; dma->page_count = user_dma.page_count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment