aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMichael Büsch <m@bues.ch>2013-02-07 10:19:30 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-02-08 14:51:09 -0500
commitaadb4640109b76cc9d0e1d8ce6b7bc3258a89170 (patch)
tree9f09447d880103463d46d5faef0bd40bbfae54bf /drivers/media
parent03a497d4b4c5205f6a365c4673e21298e681a8a6 (diff)
[media] fc0011: Add some sanity checks and cleanups
Add some sanity checks to the calculations and make the REG_16 register write consistent with the other ones. Signed-off-by: Michael Buesch <m@bues.ch> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/tuners/fc0011.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/tuners/fc0011.c b/drivers/media/tuners/fc0011.c
index f87aa5a8b8ea..3932aa81e18c 100644
--- a/drivers/media/tuners/fc0011.c
+++ b/drivers/media/tuners/fc0011.c
@@ -220,6 +220,7 @@ static int fc0011_set_params(struct dvb_frontend *fe)
220 220
221 /* Calc XIN. The PLL reference frequency is 18 MHz. */ 221 /* Calc XIN. The PLL reference frequency is 18 MHz. */
222 xdiv = fvco / 18000; 222 xdiv = fvco / 18000;
223 WARN_ON(xdiv > 0xFF);
223 frac = fvco - xdiv * 18000; 224 frac = fvco - xdiv * 18000;
224 frac = (frac << 15) / 18000; 225 frac = (frac << 15) / 18000;
225 if (frac >= 16384) 226 if (frac >= 16384)
@@ -346,6 +347,8 @@ static int fc0011_set_params(struct dvb_frontend *fe)
346 vco_cal &= FC11_VCOCAL_VALUEMASK; 347 vco_cal &= FC11_VCOCAL_VALUEMASK;
347 348
348 switch (vco_sel) { 349 switch (vco_sel) {
350 default:
351 WARN_ON(1);
349 case 0: 352 case 0:
350 if (vco_cal < 8) { 353 if (vco_cal < 8) {
351 regs[FC11_REG_VCOSEL] &= ~(FC11_VCOSEL_1 | FC11_VCOSEL_2); 354 regs[FC11_REG_VCOSEL] &= ~(FC11_VCOSEL_1 | FC11_VCOSEL_2);
@@ -427,7 +430,8 @@ static int fc0011_set_params(struct dvb_frontend *fe)
427 err = fc0011_writereg(priv, FC11_REG_RCCAL, regs[FC11_REG_RCCAL]); 430 err = fc0011_writereg(priv, FC11_REG_RCCAL, regs[FC11_REG_RCCAL]);
428 if (err) 431 if (err)
429 return err; 432 return err;
430 err = fc0011_writereg(priv, FC11_REG_16, 0xB); 433 regs[FC11_REG_16] = 0xB;
434 err = fc0011_writereg(priv, FC11_REG_16, regs[FC11_REG_16]);
431 if (err) 435 if (err)
432 return err; 436 return err;
433 437