Skip to content

Commit 2311072

Browse files
Hans Verkuilmchehab
authored andcommitted
media: tvp7002: fix uninitialized variable warning
tvp7002.c: In function 'tvp7002_g_register': tvp7002.c:691:11: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized] 691 | reg->val = val; | ~~~~~~~~~^~~~~ Just return without setting 'reg' if tvp7002_read returns an error. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent 7124ae4 commit 2311072

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/media/i2c/tvp7002.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,11 @@ static int tvp7002_g_register(struct v4l2_subdev *sd,
688688
int ret;
689689

690690
ret = tvp7002_read(sd, reg->reg & 0xff, &val);
691+
if (ret < 0)
692+
return ret;
691693
reg->val = val;
692694
reg->size = 1;
693-
return ret;
695+
return 0;
694696
}
695697

696698
/*

0 commit comments

Comments
 (0)