media: bcm2835-unicam: Fix reference counting in unicam_open

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: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
Dave Stevenson
2020-04-30 09:52:50 +01:00
committed by popcornmix
parent de4a66a0b4
commit 076c39e2b0

View File

@@ -2170,16 +2170,18 @@ static int unicam_open(struct file *file)
goto unlock;
}
node->open++;
if (!v4l2_fh_is_singular_file(file))
goto unlock;
ret = v4l2_subdev_call(dev->sensor, core, s_power, 1);
if (ret < 0 && ret != -ENOIOCTLCMD) {
v4l2_fh_release(file);
node->open--;
goto unlock;
}
node->open++;
ret = 0;
unlock: