media: imx: capture: Handle errors from v4l2_fh_open()

If the call to v4l2_fh_open() fails, return the error code instead of
proceeding normally as if nothing happened.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Laurent Pinchart 2021-02-15 05:26:34 +01:00 committed by Mauro Carvalho Chehab
parent 5722a17426
commit e2c073c7d4

View File

@ -643,13 +643,16 @@ static int capture_open(struct file *file)
return -ERESTARTSYS;
ret = v4l2_fh_open(file);
if (ret)
if (ret) {
dev_err(priv->dev, "v4l2_fh_open failed\n");
goto out;
}
ret = v4l2_pipeline_pm_get(&vfd->entity);
if (ret)
v4l2_fh_release(file);
out:
mutex_unlock(&priv->mutex);
return ret;
}