diff mbox series

[11/75] media: imx: capture: Handle errors from v4l2_fh_open()

Message ID 20210105152852.5733-12-laurent.pinchart@ideasonboard.com (mailing list archive)
State New
Headers show
Series media: imx: Miscellaneous fixes and cleanups for i.MX7 | expand

Commit Message

Laurent Pinchart Jan. 5, 2021, 3:27 p.m. UTC
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>
---
 drivers/staging/media/imx/imx-media-capture.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Philipp Zabel Jan. 6, 2021, 2:27 p.m. UTC | #1
On Tue, 2021-01-05 at 17:27 +0200, Laurent Pinchart wrote:
> 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>
> ---
>  drivers/staging/media/imx/imx-media-capture.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
> index 0b1dbff198a2..b599e30df338 100644
> --- a/drivers/staging/media/imx/imx-media-capture.c
> +++ b/drivers/staging/media/imx/imx-media-capture.c
> @@ -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;
>  }

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
index 0b1dbff198a2..b599e30df338 100644
--- a/drivers/staging/media/imx/imx-media-capture.c
+++ b/drivers/staging/media/imx/imx-media-capture.c
@@ -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;
 }