summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-12-29 19:46:01 -0500
committerMichael Krufky <mkrufky@linuxtv.org>2007-12-29 19:46:01 -0500
commitfef085961b17cf982f5f14969946b2f262090ed8 (patch)
tree9d861ef13258e2b0654d44474d25b955205f5853 /linux/drivers/media/dvb
parentf2f3421c456e70d7e97826073459bf00b78a9847 (diff)
downloadmediapointer-dvb-s2-fef085961b17cf982f5f14969946b2f262090ed8.tar.gz
mediapointer-dvb-s2-fef085961b17cf982f5f14969946b2f262090ed8.tar.bz2
tda18271: fail table lookups if frequency is out of range
From: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r--linux/drivers/media/dvb/frontends/tda18271-fe.c5
-rw-r--r--linux/drivers/media/dvb/frontends/tda18271-tables.c28
2 files changed, 20 insertions, 13 deletions
diff --git a/linux/drivers/media/dvb/frontends/tda18271-fe.c b/linux/drivers/media/dvb/frontends/tda18271-fe.c
index 2541b215d..1ef274777 100644
--- a/linux/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/linux/drivers/media/dvb/frontends/tda18271-fe.c
@@ -503,11 +503,6 @@ static int tda18271_calc_rf_cal(struct dvb_frontend *fe, u32 *freq)
if (ret < 0)
goto fail;
- /* VHF_Low band only */
- if (0 == val) {
- ret = -ERANGE;
- goto fail;
- }
regs[R_EB14] = val;
fail:
return ret;
diff --git a/linux/drivers/media/dvb/frontends/tda18271-tables.c b/linux/drivers/media/dvb/frontends/tda18271-tables.c
index e10a93bf1..f8202c40b 100644
--- a/linux/drivers/media/dvb/frontends/tda18271-tables.c
+++ b/linux/drivers/media/dvb/frontends/tda18271-tables.c
@@ -273,6 +273,7 @@ int tda18271_lookup_pll_map(enum tda18271_map_type map_type,
struct tda18271_pll_map *map = NULL;
unsigned int i = 0;
char *map_name;
+ int ret = 0;
switch (map_type) {
case MAIN_PLL:
@@ -291,12 +292,17 @@ int tda18271_lookup_pll_map(enum tda18271_map_type map_type,
if (!map) {
tda_warn("%s map is not set!\n", map_name);
- return -EINVAL;
+ ret = -EINVAL;
+ goto fail;
}
while ((map[i].lomax * 1000) < *freq) {
- if (map[i + 1].lomax == 0)
+ if (map[i].lomax == 0) {
+ tda_map("%s: frequency (%d) out of range\n",
+ map_name, *freq);
+ ret = -ERANGE;
break;
+ }
i++;
}
*post_div = map[i].pd;
@@ -304,8 +310,8 @@ int tda18271_lookup_pll_map(enum tda18271_map_type map_type,
tda_map("%s: post div = 0x%02x, div = 0x%02x\n",
map_name, *post_div, *div);
-
- return 0;
+fail:
+ return ret;
}
int tda18271_lookup_map(enum tda18271_map_type map_type, u32 *freq, u8 *val)
@@ -313,6 +319,7 @@ int tda18271_lookup_map(enum tda18271_map_type map_type, u32 *freq, u8 *val)
struct tda18271_map *map = NULL;
unsigned int i = 0;
char *map_name;
+ int ret = 0;
switch (map_type) {
case BP_FILTER:
@@ -347,19 +354,24 @@ int tda18271_lookup_map(enum tda18271_map_type map_type, u32 *freq, u8 *val)
if (!map) {
tda_warn("%s map is not set!\n", map_name);
- return -EINVAL;
+ ret = -EINVAL;
+ goto fail;
}
while ((map[i].rfmax * 1000) < *freq) {
- if (map[i + 1].rfmax == 0)
+ if (map[i].rfmax == 0) {
+ tda_map("%s: frequency (%d) out of range\n",
+ map_name, *freq);
+ ret = -ERANGE;
break;
+ }
i++;
}
*val = map[i].val;
tda_map("%s: 0x%02x\n", map_name, *val);
-
- return 0;
+fail:
+ return ret;
}
/*