[media] tda18271: prog_cal and prog_tab variables should be s32, not u8

Fix type of prog_cal and prog_tab variables to avoid any possible
calculation errors.

Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Michael Krufky 2011-04-16 13:22:10 -03:00 committed by Mauro Carvalho Chehab
parent f78028b68f
commit 381ad0ea14
1 changed files with 11 additions and 10 deletions

View File

@ -579,8 +579,8 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
#define RF3 2
u32 rf_default[3];
u32 rf_freq[3];
u8 prog_cal[3];
u8 prog_tab[3];
s32 prog_cal[3];
s32 prog_tab[3];
i = tda18271_lookup_rf_band(fe, &freq, NULL);
@ -602,32 +602,33 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
return bcal;
tda18271_calc_rf_cal(fe, &rf_freq[rf]);
prog_tab[rf] = regs[R_EB14];
prog_tab[rf] = (s32)regs[R_EB14];
if (1 == bcal)
prog_cal[rf] = tda18271_calibrate_rf(fe, rf_freq[rf]);
prog_cal[rf] =
(s32)tda18271_calibrate_rf(fe, rf_freq[rf]);
else
prog_cal[rf] = prog_tab[rf];
switch (rf) {
case RF1:
map[i].rf_a1 = 0;
map[i].rf_b1 = (s32)(prog_cal[RF1] - prog_tab[RF1]);
map[i].rf_b1 = (prog_cal[RF1] - prog_tab[RF1]);
map[i].rf1 = rf_freq[RF1] / 1000;
break;
case RF2:
dividend = (s32)(prog_cal[RF2] - prog_tab[RF2] -
prog_cal[RF1] + prog_tab[RF1]);
dividend = (prog_cal[RF2] - prog_tab[RF2] -
prog_cal[RF1] + prog_tab[RF1]);
divisor = (s32)(rf_freq[RF2] - rf_freq[RF1]) / 1000;
map[i].rf_a1 = (dividend / divisor);
map[i].rf2 = rf_freq[RF2] / 1000;
break;
case RF3:
dividend = (s32)(prog_cal[RF3] - prog_tab[RF3] -
prog_cal[RF2] + prog_tab[RF2]);
dividend = (prog_cal[RF3] - prog_tab[RF3] -
prog_cal[RF2] + prog_tab[RF2]);
divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000;
map[i].rf_a2 = (dividend / divisor);
map[i].rf_b2 = (s32)(prog_cal[RF2] - prog_tab[RF2]);
map[i].rf_b2 = (prog_cal[RF2] - prog_tab[RF2]);
map[i].rf3 = rf_freq[RF3] / 1000;
break;
default: