diff options
Diffstat (limited to '')
-rw-r--r-- | drivers/media/common/b2c2/flexcop.c | 11 | ||||
-rw-r--r-- | drivers/media/common/saa7146/saa7146_fops.c | 5 | ||||
-rw-r--r-- | drivers/media/common/videobuf2/frame_vector.c | 15 | ||||
-rw-r--r-- | drivers/media/common/videobuf2/videobuf2-dma-contig.c | 8 |
4 files changed, 23 insertions, 16 deletions
diff --git a/drivers/media/common/b2c2/flexcop.c b/drivers/media/common/b2c2/flexcop.c index cbaa61f10d5f..e7a88a2d248c 100644 --- a/drivers/media/common/b2c2/flexcop.c +++ b/drivers/media/common/b2c2/flexcop.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later /* * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III * flexcop.c - main module part @@ -15,16 +16,6 @@ * Uwe Bugla, uwe.bugla at gmx.de (doing tests, restyling code, writing docu) * Niklas Peinecke, peinecke at gdv.uni-hannover.de (hardware pid/mac * filtering) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. */ #include "flexcop.h" diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c index baf5772c52a9..e9a15de6126e 100644 --- a/drivers/media/common/saa7146/saa7146_fops.c +++ b/drivers/media/common/saa7146/saa7146_fops.c @@ -487,6 +487,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) if (hdl->error) { err = hdl->error; v4l2_ctrl_handler_free(hdl); + v4l2_device_unregister(&dev->v4l2_dev); return err; } dev->v4l2_dev.ctrl_handler = hdl; @@ -495,6 +496,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) if (vv == NULL) { ERR("out of memory. aborting.\n"); v4l2_ctrl_handler_free(hdl); + v4l2_device_unregister(&dev->v4l2_dev); return -ENOMEM; } ext_vv->vid_ops = saa7146_video_ioctl_ops; @@ -521,7 +523,8 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) ERR("out of memory. aborting.\n"); kfree(vv); v4l2_ctrl_handler_free(hdl); - return -1; + v4l2_device_unregister(&dev->v4l2_dev); + return -ENOMEM; } saa7146_video_uops.init(dev,vv); diff --git a/drivers/media/common/videobuf2/frame_vector.c b/drivers/media/common/videobuf2/frame_vector.c index ce879f6f8f82..542dde9d2609 100644 --- a/drivers/media/common/videobuf2/frame_vector.c +++ b/drivers/media/common/videobuf2/frame_vector.c @@ -37,6 +37,7 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; + int ret_pin_user_pages_fast = 0; int ret = 0; int err; @@ -56,6 +57,7 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, vec->is_pfns = false; goto out_unlocked; } + ret_pin_user_pages_fast = ret; mmap_read_lock(mm); vec->got_ref = false; @@ -71,7 +73,18 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, while (ret < nr_frames && start + PAGE_SIZE <= vma->vm_end) { err = follow_pfn(vma, start, &nums[ret]); if (err) { - if (ret == 0) + if (ret) + goto out; + // If follow_pfn() returns -EINVAL, then this + // is not an IO mapping or a raw PFN mapping. + // In that case, return the original error from + // pin_user_pages_fast(). Otherwise this + // function would return -EINVAL when + // pin_user_pages_fast() returned -ENOMEM, + // which makes debugging hard. + if (err == -EINVAL && ret_pin_user_pages_fast) + ret = ret_pin_user_pages_fast; + else ret = err; goto out; } diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c index 556e42ba66e5..7c4096e62173 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c @@ -257,7 +257,7 @@ static void *vb2_dc_alloc(struct vb2_buffer *vb, ret = vb2_dc_alloc_coherent(buf); if (ret) { - dev_err(dev, "dma alloc of size %ld failed\n", size); + dev_err(dev, "dma alloc of size %lu failed\n", size); kfree(buf); return ERR_PTR(-ENOMEM); } @@ -298,9 +298,9 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) vma->vm_ops->open(vma); - pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n", - __func__, (unsigned long)buf->dma_addr, vma->vm_start, - buf->size); + pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %lu\n", + __func__, (unsigned long)buf->dma_addr, vma->vm_start, + buf->size); return 0; } |