diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-11-02 00:05:58 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-12-11 21:04:56 +0300 |
commit | 74a6799ca9823690046091361ce062d3ccfeac8d (patch) | |
tree | ab9e00fdf3be1d4a6b46a7596e0e1ae680344a22 /drivers | |
parent | e639c869558cc1172cacf7477819c7e9db60e3a4 (diff) | |
download | linux-74a6799ca9823690046091361ce062d3ccfeac8d.tar.xz |
media: m88rs2000: handle the case where tuner doesn't have get_frequency
If the tuner doesn't have get_frequency() callback, the current
code will place a random value as the frequency offset. That
doesn't seem right! The better is to just assume that, on such
case, the tuner was able to set the exact frequency that was
requested.
Fixes a smatch warning:
drivers/media/dvb-frontends/m88rs2000.c:639 m88rs2000_set_frontend() error: uninitialized symbol 'tuner_freq'.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb-frontends/m88rs2000.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index ce6c21d405ee..e34dab41d104 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -630,13 +630,16 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe) if (ret < 0) return -ENODEV; - if (fe->ops.tuner_ops.get_frequency) + if (fe->ops.tuner_ops.get_frequency) { ret = fe->ops.tuner_ops.get_frequency(fe, &tuner_freq); - if (ret < 0) - return -ENODEV; + if (ret < 0) + return -ENODEV; - offset = (s16)((s32)tuner_freq - c->frequency); + offset = (s16)((s32)tuner_freq - c->frequency); + } else { + offset = 0; + } /* default mclk value 96.4285 * 2 * 1000 = 192857 */ if (((c->frequency % 192857) >= (192857 - 3000)) || |