···508508 u32 div;509509510510 int ret = tda18271_lookup_pll_map(fe, MAIN_PLL, &freq, &pd, &d);511511- if (ret < 0)511511+ if (tda_fail(ret))512512 goto fail;513513514514 regs[R_MPD] = (0x77 & pd);···540540 u32 div;541541542542 int ret = tda18271_lookup_pll_map(fe, CAL_PLL, &freq, &pd, &d);543543- if (ret < 0)543543+ if (tda_fail(ret))544544 goto fail;545545546546 regs[R_CPD] = pd;···564564 u8 val;565565566566 int ret = tda18271_lookup_map(fe, BP_FILTER, freq, &val);567567- if (ret < 0)567567+ if (tda_fail(ret))568568 goto fail;569569570570 regs[R_EP1] &= ~0x07; /* clear bp filter bits */···581581 u8 val;582582583583 int ret = tda18271_lookup_map(fe, RF_CAL_KMCO, freq, &val);584584- if (ret < 0)584584+ if (tda_fail(ret))585585 goto fail;586586587587 regs[R_EB13] &= ~0x7c; /* clear k & m bits */···598598 u8 val;599599600600 int ret = tda18271_lookup_map(fe, RF_BAND, freq, &val);601601- if (ret < 0)601601+ if (tda_fail(ret))602602 goto fail;603603604604 regs[R_EP2] &= ~0xe0; /* clear rf band bits */···615615 u8 val;616616617617 int ret = tda18271_lookup_map(fe, GAIN_TAPER, freq, &val);618618- if (ret < 0)618618+ if (tda_fail(ret))619619 goto fail;620620621621 regs[R_EP2] &= ~0x1f; /* clear gain taper bits */···632632 u8 val;633633634634 int ret = tda18271_lookup_map(fe, IR_MEASURE, freq, &val);635635- if (ret < 0)635635+ if (tda_fail(ret))636636 goto fail;637637638638 regs[R_EP5] &= ~0x07;
+28-28
drivers/media/common/tuners/tda18271-fe.c
···8787 regs[R_EB22] = 0x00;8888 regs[R_EB22] |= map->rfagc_top;8989 ret = tda18271_write_regs(fe, R_EB22, 1);9090- if (ret < 0)9090+ if (tda_fail(ret))9191 goto fail;92929393 /* --------------------------------------------------------------- */···125125 regs[R_EB1] &= ~0x01;126126127127 ret = tda18271_write_regs(fe, R_EB1, 1);128128- if (ret < 0)128128+ if (tda_fail(ret))129129 goto fail;130130131131 /* --------------------------------------------------------------- */···147147 }148148149149 ret = tda18271_write_regs(fe, R_TM, 7);150150- if (ret < 0)150150+ if (tda_fail(ret))151151 goto fail;152152153153 /* force charge pump source */···225225226226 /* power up */227227 ret = tda18271_set_standby_mode(fe, 0, 0, 0);228228- if (ret < 0)228228+ if (tda_fail(ret))229229 goto fail;230230231231 /* read die current temperature */···237237 rf_tab = regs[R_EB14];238238239239 i = tda18271_lookup_rf_band(fe, &freq, NULL);240240- if (i < 0)241241- return -EINVAL;240240+ if (tda_fail(i))241241+ return i;242242243243 if ((0 == map[i].rf3) || (freq / 1000 < map[i].rf2)) {244244 approx = map[i].rf_a1 *···273273 /* power up detector 1 */274274 regs[R_EB12] &= ~0x20;275275 ret = tda18271_write_regs(fe, R_EB12, 1);276276- if (ret < 0)276276+ if (tda_fail(ret))277277 goto fail;278278279279 regs[R_EB18] &= ~0x80; /* turn agc1 loop on */280280 regs[R_EB18] &= ~0x03; /* set agc1_gain to 6 dB */281281 ret = tda18271_write_regs(fe, R_EB18, 1);282282- if (ret < 0)282282+ if (tda_fail(ret))283283 goto fail;284284285285 regs[R_EB21] |= 0x03; /* set agc2_gain to -6 dB */286286287287 /* POR mode */288288 ret = tda18271_set_standby_mode(fe, 1, 0, 0);289289- if (ret < 0)289289+ if (tda_fail(ret))290290 goto fail;291291292292 /* disable 1.5 MHz low pass filter */···438438439439 /* read power detection info, stored in EB10 */440440 ret = tda18271_read_extended(fe);441441- if (ret < 0)441441+ if (tda_fail(ret))442442 return ret;443443444444 /* algorithm initialization */···466466467467 /* read power detection info, stored in EB10 */468468 ret = tda18271_read_extended(fe);469469- if (ret < 0)469469+ if (tda_fail(ret))470470 return ret;471471472472 count += 200;···511511 regs[R_EP4] &= ~0x1c; /* clear if level bits */512512513513 ret = tda18271_write_regs(fe, R_EP3, 2);514514- if (ret < 0)514514+ if (tda_fail(ret))515515 goto fail;516516517517 regs[R_EB18] &= ~0x03; /* set agc1_gain to 6 dB */518518 ret = tda18271_write_regs(fe, R_EB18, 1);519519- if (ret < 0)519519+ if (tda_fail(ret))520520 goto fail;521521522522 regs[R_EB21] &= ~0x03; /* set agc2_gain to -15 dB */···546546547547 i = tda18271_lookup_rf_band(fe, &freq, NULL);548548549549- if (i < 0)549549+ if (tda_fail(i))550550 return i;551551552552 rf_default[RF1] = 1000 * map[i].rf1_def;···560560561561 /* look for optimized calibration frequency */562562 bcal = tda18271_powerscan(fe, &rf_default[rf], &rf_freq[rf]);563563- if (bcal < 0)563563+ if (tda_fail(bcal))564564 return bcal;565565566566 tda18271_calc_rf_cal(fe, &rf_freq[rf]);···610610 msleep(200);611611612612 ret = tda18271_powerscan_init(fe);613613- if (ret < 0)613613+ if (tda_fail(ret))614614 goto fail;615615616616 /* rf band calibration */···618618 ret =619619 tda18271_rf_tracking_filters_init(fe, 1000 *620620 priv->rf_cal_state[i].rfmax);621621- if (ret < 0)621621+ if (tda_fail(ret))622622 goto fail;623623 }624624···643643 return 0;644644645645 ret = tda18271_calc_rf_filter_curve(fe);646646- if (ret < 0)646646+ if (tda_fail(ret))647647 goto fail;648648649649 ret = tda18271_por(fe);650650- if (ret < 0)650650+ if (tda_fail(ret))651651 goto fail;652652653653 tda_info("tda18271: RF tracking filter calibration complete\n");···715715 tda18271_calc_main_pll(fe, N);716716717717 ret = tda18271_write_regs(fe, R_EP3, 11);718718- if (ret < 0)718718+ if (tda_fail(ret))719719 return ret;720720721721 msleep(5); /* RF tracking filter calibration initialization */···768768 int ret;769769770770 ret = tda18271_read_regs(fe);771771- if (ret < 0)771771+ if (tda_fail(ret))772772 goto fail;773773774774 /* test IR_CAL_OK to see if we need init */···787787788788 /* power up */789789 ret = tda18271_set_standby_mode(fe, 0, 0, 0);790790- if (ret < 0)790790+ if (tda_fail(ret))791791 goto fail;792792793793 /* initialization */794794 ret = tda18271_ir_cal_init(fe);795795- if (ret < 0)795795+ if (tda_fail(ret))796796 goto fail;797797798798 if (priv->id == TDA18271HDC2)···813813 freq, map->if_freq, bw, map->agc_mode, map->std);814814815815 ret = tda18271_init(fe);816816- if (ret < 0)816816+ if (tda_fail(ret))817817 goto fail;818818819819 mutex_lock(&priv->lock);···894894895895 ret = tda18271_tune(fe, map, freq, bw);896896897897- if (ret < 0)897897+ if (tda_fail(ret))898898 goto fail;899899900900 priv->frequency = freq;···950950951951 ret = tda18271_tune(fe, map, freq, 0);952952953953- if (ret < 0)953953+ if (tda_fail(ret))954954 goto fail;955955956956 priv->frequency = freq;···11531153 if (cfg)11541154 priv->small_i2c = cfg->small_i2c;1155115511561156- if (tda18271_get_id(fe) < 0)11561156+ if (tda_fail(tda18271_get_id(fe)))11571157 goto fail;1158115811591159- if (tda18271_assign_map_layout(fe) < 0)11591159+ if (tda_fail(tda18271_assign_map_layout(fe)))11601160 goto fail;1161116111621162 mutex_lock(&priv->lock);
+9
drivers/media/common/tuners/tda18271-priv.h
···153153#define tda_reg(fmt, arg...) dprintk(KERN_DEBUG, DBG_REG, fmt, ##arg)154154#define tda_cal(fmt, arg...) dprintk(KERN_DEBUG, DBG_CAL, fmt, ##arg)155155156156+#define tda_fail(ret) \157157+({ \158158+ int __ret; \159159+ __ret = (ret < 0); \160160+ if (__ret) \161161+ tda_printk(KERN_ERR, "error %d on line %d\n", ret, __LINE__);\162162+ __ret; \163163+})164164+156165/*---------------------------------------------------------------------*/157166158167enum tda18271_map_type {