diff mbox series

[2/6] media: ti: cal: fix useless variable init

Message ID 20220421143449.552312-3-tomi.valkeinen@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series media: ti: cal: misc fixes | expand

Commit Message

Tomi Valkeinen April 21, 2022, 2:34 p.m. UTC
'ret' is initialized needlessly in cal_legacy_try_fmt_vid_cap(). We can
also move the variable to the for block, which is the only place where
it is used.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/media/platform/ti/cal/cal-video.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart April 21, 2022, 8:02 p.m. UTC | #1
Hi Tomi,

Thank you for the patch.

On Thu, Apr 21, 2022 at 05:34:45PM +0300, Tomi Valkeinen wrote:
> 'ret' is initialized needlessly in cal_legacy_try_fmt_vid_cap(). We can
> also move the variable to the for block, which is the only place where
> it is used.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/platform/ti/cal/cal-video.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/ti/cal/cal-video.c b/drivers/media/platform/ti/cal/cal-video.c
> index 3e936a2ca36c..1cbd9bda1892 100644
> --- a/drivers/media/platform/ti/cal/cal-video.c
> +++ b/drivers/media/platform/ti/cal/cal-video.c
> @@ -195,7 +195,7 @@ static int cal_legacy_try_fmt_vid_cap(struct file *file, void *priv,
>  	struct cal_ctx *ctx = video_drvdata(file);
>  	const struct cal_format_info *fmtinfo;
>  	struct v4l2_subdev_frame_size_enum fse;
> -	int ret, found;
> +	int found;
>  
>  	fmtinfo = find_format_by_pix(ctx, f->fmt.pix.pixelformat);
>  	if (!fmtinfo) {
> @@ -210,12 +210,13 @@ static int cal_legacy_try_fmt_vid_cap(struct file *file, void *priv,
>  	f->fmt.pix.field = ctx->v_fmt.fmt.pix.field;
>  
>  	/* check for/find a valid width/height */
> -	ret = 0;
>  	found = false;
>  	fse.pad = 0;
>  	fse.code = fmtinfo->code;
>  	fse.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>  	for (fse.index = 0; ; fse.index++) {
> +		int ret;
> +
>  		ret = v4l2_subdev_call(ctx->phy->source, pad, enum_frame_size,
>  				       NULL, &fse);
>  		if (ret)
diff mbox series

Patch

diff --git a/drivers/media/platform/ti/cal/cal-video.c b/drivers/media/platform/ti/cal/cal-video.c
index 3e936a2ca36c..1cbd9bda1892 100644
--- a/drivers/media/platform/ti/cal/cal-video.c
+++ b/drivers/media/platform/ti/cal/cal-video.c
@@ -195,7 +195,7 @@  static int cal_legacy_try_fmt_vid_cap(struct file *file, void *priv,
 	struct cal_ctx *ctx = video_drvdata(file);
 	const struct cal_format_info *fmtinfo;
 	struct v4l2_subdev_frame_size_enum fse;
-	int ret, found;
+	int found;
 
 	fmtinfo = find_format_by_pix(ctx, f->fmt.pix.pixelformat);
 	if (!fmtinfo) {
@@ -210,12 +210,13 @@  static int cal_legacy_try_fmt_vid_cap(struct file *file, void *priv,
 	f->fmt.pix.field = ctx->v_fmt.fmt.pix.field;
 
 	/* check for/find a valid width/height */
-	ret = 0;
 	found = false;
 	fse.pad = 0;
 	fse.code = fmtinfo->code;
 	fse.which = V4L2_SUBDEV_FORMAT_ACTIVE;
 	for (fse.index = 0; ; fse.index++) {
+		int ret;
+
 		ret = v4l2_subdev_call(ctx->phy->source, pad, enum_frame_size,
 				       NULL, &fse);
 		if (ret)