aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYizhuo <yzhai003@ucr.edu>2019-01-30 12:33:30 -0500
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-04-22 13:05:54 -0400
commit37d1e62b5bb3b1229d0c49f2ee45e67dc67274be (patch)
tree98bd9bfc3b581371d916d6e6c51baed904fe72ec
parent1e98a8400ae8712f2b2d52ed6c1c6231607ed854 (diff)
media: ts2020: Variable "utmp" in function ts2020_set_tuner_rf() could be uninitialized
In function ts2020_set_tuner_rf(), local variable "utmp" could be uninitialized if function regmap_read() returns -EINVAL. However, this value is used in if statement and written to the register, which is potentially unsafe. Signed-off-by: Yizhuo <yzhai003@ucr.edu> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--drivers/media/dvb-frontends/ts2020.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c
index e5cd2cd414f4..0af9b335be12 100644
--- a/drivers/media/dvb-frontends/ts2020.c
+++ b/drivers/media/dvb-frontends/ts2020.c
@@ -180,6 +180,9 @@ static int ts2020_set_tuner_rf(struct dvb_frontend *fe)
unsigned int utmp;
ret = regmap_read(dev->regmap, 0x3d, &utmp);
+ if (ret)
+ return ret;
+
utmp &= 0x7f;
if (utmp < 0x16)
utmp = 0xa1;