media: sun6i-csi: Allow the video device to be open multiple times

Previously it was possible, but a recent fix for uninitialized
`ret` variable broke this behavior.

v4l2_fh_is_singular_file() check is there just to determine
whether the power needs to be enabled, and it's not a failure
if it returns false.

Fixes: ba9139116b ("media: sun6i-csi: add a missing return code")
Signed-off-by: Ondrej Jirman <megous@megous.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Ondrej Jirman 2021-09-08 12:56:09 +02:00 коммит произвёл Mauro Carvalho Chehab
Родитель 6d0d779b21
Коммит 8ed8528346
1 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -467,7 +467,7 @@ static const struct v4l2_ioctl_ops sun6i_video_ioctl_ops = {
static int sun6i_video_open(struct file *file)
{
struct sun6i_video *video = video_drvdata(file);
int ret;
int ret = 0;
if (mutex_lock_interruptible(&video->lock))
return -ERESTARTSYS;
@ -481,10 +481,8 @@ static int sun6i_video_open(struct file *file)
goto fh_release;
/* check if already powered */
if (!v4l2_fh_is_singular_file(file)) {
ret = -EBUSY;
if (!v4l2_fh_is_singular_file(file))
goto unlock;
}
ret = sun6i_csi_set_power(video->csi, true);
if (ret < 0)