struct tda18271_pll_map *map = NULL;
unsigned int i = 0;
char *map_name;
+ int ret = 0;
switch (map_type) {
case MAIN_PLL:
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;
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)
struct tda18271_map *map = NULL;
unsigned int i = 0;
char *map_name;
+ int ret = 0;
switch (map_type) {
case BP_FILTER:
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;
}
/*