v4lvideo: fix cat dev panic [1/1]
authorjintao xu <jintao.xu@amlogic.com>
Thu, 28 Nov 2019 06:24:40 +0000 (14:24 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 28 Nov 2019 09:29:15 +0000 (02:29 -0700)
PD#SWPL-17478

Problem:
cat /dev/video33 panic

Solution:
read return 0

Verify:
U212

Change-Id: Idcabf7eca7d99d020fb759261fd7f613da83b096
Signed-off-by: jintao xu <jintao.xu@amlogic.com>
drivers/amlogic/media/video_processor/v4lvideo/v4lvideo.c

index acb973c69f8cebf28d7c9a3ca4c0c46c4f83844e..a8256244555acdcb9bc40b8414b71e1bf13962b0 100644 (file)
@@ -544,6 +544,13 @@ static int vidioc_close(struct file *file)
        return 0;
 }
 
+static ssize_t vidioc_read(struct file *file, char __user *data,
+                          size_t count, loff_t *ppos)
+{
+       pr_info("v4lvideo read\n");
+       return 0;
+}
+
 static int vidioc_querycap(struct file *file,
                           void *priv,
                           struct v4l2_capability *cap)
@@ -791,7 +798,7 @@ static const struct v4l2_file_operations v4lvideo_v4l2_fops = {
        .owner = THIS_MODULE,
        .open = vidioc_open,
        .release = vidioc_close,
-       .read = vb2_fop_read,
+       .read = vidioc_read,
        .poll = vb2_fop_poll,
        .unlocked_ioctl = video_ioctl2,/* V4L2 ioctl handler */
        .mmap = vb2_fop_mmap,