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>
This commit is contained in:
Yizhuo 2019-01-30 12:33:30 -05:00 committed by Mauro Carvalho Chehab
parent 1e98a8400a
commit 37d1e62b5b
1 changed files with 3 additions and 0 deletions

View File

@ -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;