diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2020-10-08 13:59:12 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-10-08 14:13:59 +0200 |
commit | 2311072d9905b1f810a3c0665362ee552f076c26 (patch) | |
tree | d3df02d1154edf3ca30be97e45a03a7b3a82f02a | |
parent | 7124ae48f2a45399789bcc14389614c899f6aa7c (diff) |
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>
-rw-r--r-- | drivers/media/i2c/tvp7002.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c index de313b1306da..ada4ec5ef782 100644 --- a/drivers/media/i2c/tvp7002.c +++ b/drivers/media/i2c/tvp7002.c @@ -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; } /* |