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

media: bcm2835-unicam: Fix reference counting in unicam_open

raspberrypi inclusion
category: feature
bugzilla: 50432

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

The reference counting of node->open was only incremented after
a check that the node was v4l2_fh_is_singular_file, which resulted
in the counting going wrong and s_power not being called at an
appropriate time.
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>
上级 a1886e9c
...@@ -2170,16 +2170,18 @@ static int unicam_open(struct file *file) ...@@ -2170,16 +2170,18 @@ static int unicam_open(struct file *file)
goto unlock; goto unlock;
} }
node->open++;
if (!v4l2_fh_is_singular_file(file)) if (!v4l2_fh_is_singular_file(file))
goto unlock; goto unlock;
ret = v4l2_subdev_call(dev->sensor, core, s_power, 1); ret = v4l2_subdev_call(dev->sensor, core, s_power, 1);
if (ret < 0 && ret != -ENOIOCTLCMD) { if (ret < 0 && ret != -ENOIOCTLCMD) {
v4l2_fh_release(file); v4l2_fh_release(file);
node->open--;
goto unlock; goto unlock;
} }
node->open++;
ret = 0; ret = 0;
unlock: unlock:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册