media: imx: capture: Handle errors from v4l2_fh_open()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 15 Feb 2021 04:26:34 +0000 (05:26 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 11 Mar 2021 10:59:47 +0000 (11:59 +0100)
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>
drivers/staging/media/imx/imx-media-capture.c

index 50bbcb1217e3fbc59081b6cb08cc0aeb810e2cb2..101ad562c2eb07fd46d3ba8c8e830a3c5ab48cd6 100644 (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;
 }