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>
This commit is contained in:
parent
7124ae48f2
commit
2311072d99
|
@ -688,9 +688,11 @@ static int tvp7002_g_register(struct v4l2_subdev *sd,
|
|||
int ret;
|
||||
|
||||
ret = tvp7002_read(sd, reg->reg & 0xff, &val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
reg->val = val;
|
||||
reg->size = 1;
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue