]> git.baikalelectronics.ru Git - kernel.git/commit
[media] ivtv: yuv: handle get_user_pages() -errno returns
authorPaul Cassella <fortytwo-ivtv@manetheren.bigw.org>
Sat, 12 Feb 2011 13:39:51 +0000 (10:39 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 21 Mar 2011 23:32:35 +0000 (20:32 -0300)
commit927a01683307af466b2ac48512acfa19e5c537c2
treeca2e84f40e2483357882570b1fb82d17143830ef
parent42e885cf4c1c05217a1f20388b9c2e8a9f1d1914
[media] ivtv: yuv: handle get_user_pages() -errno returns

get_user_pages() may return -errno, such as -EFAULT.  So don't blindly use
its return value as an offset into dma->map[] for the next get_user_pages()
call.  Since we'll give up and return an error if either fails, don't even
make the second call if the first failed to give us exactly what we were
looking for.

The old code would also call put_page() on as many elements of dma->map[]
as we'd asked for, regardless of how many were valid.

[Andy Walls modified this patch to return -EFAULT instead of -EINVAL
as Paul's observation "I'm not sure -EINVAL is the best return code vs
-EFAULT or -ENOMEM, [...]" was correct.  The return value bubbles up
as a return code for write(), for which the V4L2 API spec indicates
EINVAL is incorrect and EFAULT is correct.]

Signed-off-by: Paul Cassella <fortytwo-ivtv@maneteren.bigw.org>
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/ivtv/ivtv-yuv.c