summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-10-08 14:59:12 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-10-08 15:13:59 +0300
commit2311072d9905b1f810a3c0665362ee552f076c26 (patch)
treed3df02d1154edf3ca30be97e45a03a7b3a82f02a /drivers/media
parent7124ae48f2a45399789bcc14389614c899f6aa7c (diff)
downloadlinux-2311072d9905b1f810a3c0665362ee552f076c26.tar.xz
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>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/i2c/tvp7002.c4
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;
}
/*