diff mbox series

[v3,1/6] rcar-vin: Fix incorrect return statement in rvin_try_format()

Message ID 20190904215409.30136-2-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State Accepted
Delegated to: Kieran Bingham
Headers show
Series rcar-vin: Add support for V4L2_FIELD_ALTERNATE | expand

Commit Message

Niklas Söderlund Sept. 4, 2019, 9:54 p.m. UTC
While refactoring code the return statement became corrupted, fix it by
returning the correct return code.

Reported-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Fixes: 897e371389e77514 ("media: rcar-vin: simplify how formats are set and reset"
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

---

* Changes since v2
- Set ret to 0 if the subdevice do not implement set_fmt and returns
  -ENOIOCTLCMD instead of returning the not implemented error.
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kieran Bingham Sept. 13, 2019, 1:20 p.m. UTC | #1
Hi Niklas,

On 04/09/2019 22:54, Niklas Söderlund wrote:
> While refactoring code the return statement became corrupted, fix it by
> returning the correct return code.
> 
> Reported-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> Fixes: 897e371389e77514 ("media: rcar-vin: simplify how formats are set and reset"
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> ---
> 
> * Changes since v2
> - Set ret to 0 if the subdevice do not implement set_fmt and returns
>   -ENOIOCTLCMD instead of returning the not implemented error.
> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index cbc1c07f0a9631a4..ec2796413e26822d 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -208,6 +208,7 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which,
>  	ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format);
>  	if (ret < 0 && ret != -ENOIOCTLCMD)
>  		goto done;
> +	ret = 0;
>  
>  	v4l2_fill_pix_format(pix, &format.format);
>  
> @@ -242,7 +243,7 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which,
>  done:
>  	v4l2_subdev_free_pad_config(pad_cfg);
>  
> -	return 0;
> +	return ret;
>  }
>  
>  static int rvin_querycap(struct file *file, void *priv,
>
diff mbox series

Patch

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index cbc1c07f0a9631a4..ec2796413e26822d 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -208,6 +208,7 @@  static int rvin_try_format(struct rvin_dev *vin, u32 which,
 	ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format);
 	if (ret < 0 && ret != -ENOIOCTLCMD)
 		goto done;
+	ret = 0;
 
 	v4l2_fill_pix_format(pix, &format.format);
 
@@ -242,7 +243,7 @@  static int rvin_try_format(struct rvin_dev *vin, u32 which,
 done:
 	v4l2_subdev_free_pad_config(pad_cfg);
 
-	return 0;
+	return ret;
 }
 
 static int rvin_querycap(struct file *file, void *priv,