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@xxxxxxx> --- drivers/media/dvb-frontends/ts2020.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c index 931e5c98da8a..e351039f2eae 100644 --- a/drivers/media/dvb-frontends/ts2020.c +++ b/drivers/media/dvb-frontends/ts2020.c @@ -177,9 +177,12 @@ static int ts2020_set_tuner_rf(struct dvb_frontend *fe) { struct ts2020_priv *dev = fe->tuner_priv; int ret; - unsigned int utmp; + unsigned int utmp = 0; ret = regmap_read(dev->regmap, 0x3d, &utmp); + if (ret) + return ret; + utmp &= 0x7f; if (utmp < 0x16) utmp = 0xa1; -- 2.17.1