]> git.baikalelectronics.ru Git - kernel.git/commit
media: vb2: frame_vector.c: don't overwrite error code
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 11 Nov 2021 10:56:29 +0000 (11:56 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 30 Nov 2021 11:07:36 +0000 (12:07 +0100)
commitda65cf15a7b011b9c3c10af5b7d5add9b4fb97a5
tree87c7a55e7d9a965ba12a67b332963f2cf74d7168
parent283f6b82a9f34faf676d67f83c97191fae4dad34
media: vb2: frame_vector.c: don't overwrite error code

get_vaddr_frames() first calls pin_user_pages_fast() and if
that fails tries follow_pfn(). But if that also fails, then
the error code from pin_user_pages_fast() is overwritten with
the error code from follow_pfn().

Specifically if pin_user_pages_fast() returns -ENOMEM, then
follow_pfn() will overwrite that with -EINVAL, which is very
confusing.

So store the error code from pin_user_pages_fast() and return
that if follow_pfn() returns -EINVAL. -EINVAL indicates that
the page is unsuitable for follow_pfn, so pin_user_pages_fast()
was the correct call to make, and that error code should be
returned instead.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/common/videobuf2/frame_vector.c