• Hans Verkuil's avatar
    media: vb2: frame_vector.c: don't overwrite error code · 89ab2d39
    Hans Verkuil authored
    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: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    89ab2d39
frame_vector.c 6.3 KB