From: Yizhuo Date: Wed, 30 Jan 2019 17:33:30 +0000 (-0500) Subject: media: ts2020: Variable "utmp" in function ts2020_set_tuner_rf() could be uninitialized X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=37d1e62b5bb3b1229d0c49f2ee45e67dc67274be;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- 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;