Commit d35fccaf authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (7837): tda18271: fix error handling in init and sleep paths

Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent dc9d522a
...@@ -227,9 +227,8 @@ int tda18271_charge_pump_source(struct dvb_frontend *fe, ...@@ -227,9 +227,8 @@ int tda18271_charge_pump_source(struct dvb_frontend *fe,
regs[r_cp] &= ~0x20; regs[r_cp] &= ~0x20;
regs[r_cp] |= ((force & 1) << 5); regs[r_cp] |= ((force & 1) << 5);
tda18271_write_regs(fe, r_cp, 1);
return 0; return tda18271_write_regs(fe, r_cp, 1);
} }
int tda18271_init_regs(struct dvb_frontend *fe) int tda18271_init_regs(struct dvb_frontend *fe)
...@@ -494,9 +493,7 @@ int tda18271_set_standby_mode(struct dvb_frontend *fe, ...@@ -494,9 +493,7 @@ int tda18271_set_standby_mode(struct dvb_frontend *fe,
sm_lt ? (1 << 6) : 0 | sm_lt ? (1 << 6) : 0 |
sm_xt ? (1 << 5) : 0; sm_xt ? (1 << 5) : 0;
tda18271_write_regs(fe, R_EP3, 1); return tda18271_write_regs(fe, R_EP3, 1);
return 0;
} }
/*---------------------------------------------------------------------*/ /*---------------------------------------------------------------------*/
......
...@@ -719,45 +719,56 @@ static int tda18271_ir_cal_init(struct dvb_frontend *fe) ...@@ -719,45 +719,56 @@ static int tda18271_ir_cal_init(struct dvb_frontend *fe)
{ {
struct tda18271_priv *priv = fe->tuner_priv; struct tda18271_priv *priv = fe->tuner_priv;
unsigned char *regs = priv->tda18271_regs; unsigned char *regs = priv->tda18271_regs;
int ret;
tda18271_read_regs(fe); ret = tda18271_read_regs(fe);
if (ret < 0)
goto fail;
/* test IR_CAL_OK to see if we need init */ /* test IR_CAL_OK to see if we need init */
if ((regs[R_EP1] & 0x08) == 0) if ((regs[R_EP1] & 0x08) == 0)
tda18271_init_regs(fe); ret = tda18271_init_regs(fe);
fail:
return 0; return ret;
} }
static int tda18271_init(struct dvb_frontend *fe) static int tda18271_init(struct dvb_frontend *fe)
{ {
struct tda18271_priv *priv = fe->tuner_priv; struct tda18271_priv *priv = fe->tuner_priv;
int ret;
mutex_lock(&priv->lock); mutex_lock(&priv->lock);
/* power up */ /* power up */
tda18271_set_standby_mode(fe, 0, 0, 0); ret = tda18271_set_standby_mode(fe, 0, 0, 0);
if (ret < 0)
goto fail;
/* initialization */ /* initialization */
tda18271_ir_cal_init(fe); ret = tda18271_ir_cal_init(fe);
if (ret < 0)
goto fail;
if (priv->id == TDA18271HDC2) if (priv->id == TDA18271HDC2)
tda18271c2_rf_cal_init(fe); tda18271c2_rf_cal_init(fe);
fail:
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
return 0; return ret;
} }
static int tda18271_tune(struct dvb_frontend *fe, static int tda18271_tune(struct dvb_frontend *fe,
struct tda18271_std_map_item *map, u32 freq, u32 bw) struct tda18271_std_map_item *map, u32 freq, u32 bw)
{ {
struct tda18271_priv *priv = fe->tuner_priv; struct tda18271_priv *priv = fe->tuner_priv;
int ret;
tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n", tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n",
freq, map->if_freq, bw, map->agc_mode, map->std); freq, map->if_freq, bw, map->agc_mode, map->std);
tda18271_init(fe); ret = tda18271_init(fe);
if (ret < 0)
goto fail;
mutex_lock(&priv->lock); mutex_lock(&priv->lock);
...@@ -772,8 +783,8 @@ static int tda18271_tune(struct dvb_frontend *fe, ...@@ -772,8 +783,8 @@ static int tda18271_tune(struct dvb_frontend *fe,
tda18271_channel_configuration(fe, map, freq, bw); tda18271_channel_configuration(fe, map, freq, bw);
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
fail:
return 0; return ret;
} }
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
...@@ -905,16 +916,17 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe, ...@@ -905,16 +916,17 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe,
static int tda18271_sleep(struct dvb_frontend *fe) static int tda18271_sleep(struct dvb_frontend *fe)
{ {
struct tda18271_priv *priv = fe->tuner_priv; struct tda18271_priv *priv = fe->tuner_priv;
int ret;
mutex_lock(&priv->lock); mutex_lock(&priv->lock);
/* standby mode w/ slave tuner output /* standby mode w/ slave tuner output
* & loop thru & xtal oscillator on */ * & loop thru & xtal oscillator on */
tda18271_set_standby_mode(fe, 1, 0, 0); ret = tda18271_set_standby_mode(fe, 1, 0, 0);
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
return 0; return ret;
} }
static int tda18271_release(struct dvb_frontend *fe) static int tda18271_release(struct dvb_frontend *fe)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment