提交 0ddf20fe 编写于 作者: D Dave Stevenson 提交者: Zheng Zengkai

media: bcm2835-unicam: Ensure type is VIDEO_CAPTURE in [g|s]_selection

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

[g|s]_selection pass in a buffer type that needs to be validated
before passing on to the sensor subdev.
Signed-off-by: NDave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 97ce4ede
...@@ -1885,6 +1885,9 @@ static int unicam_s_selection(struct file *file, void *priv, ...@@ -1885,6 +1885,9 @@ static int unicam_s_selection(struct file *file, void *priv,
.r = sel->r, .r = sel->r,
}; };
if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
return v4l2_subdev_call(dev->sensor, pad, set_selection, NULL, &sdsel); return v4l2_subdev_call(dev->sensor, pad, set_selection, NULL, &sdsel);
} }
...@@ -1899,6 +1902,9 @@ static int unicam_g_selection(struct file *file, void *priv, ...@@ -1899,6 +1902,9 @@ static int unicam_g_selection(struct file *file, void *priv,
}; };
int ret; int ret;
if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
ret = v4l2_subdev_call(dev->sensor, pad, get_selection, NULL, &sdsel); ret = v4l2_subdev_call(dev->sensor, pad, get_selection, NULL, &sdsel);
if (!ret) if (!ret)
sel->r = sdsel.r; sel->r = sdsel.r;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册