aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-05-03 17:20:21 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-05-14 01:54:04 -0400
commitd35fccaffd095e79691cd07a49a36867cb275b72 (patch)
treea9b6995cc39827cf486c70e6b3aab1ca11df8a57 /drivers
parentdc9d522a1358bfb87e9ed8718cc1e4d5141a5468 (diff)
V4L/DVB (7837): tda18271: fix error handling in init and sleep paths
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/common/tuners/tda18271-common.c7
-rw-r--r--drivers/media/common/tuners/tda18271-fe.c38
2 files changed, 27 insertions, 18 deletions
diff --git a/drivers/media/common/tuners/tda18271-common.c b/drivers/media/common/tuners/tda18271-common.c
index e27a7620a32f..9001d422cc1c 100644
--- a/drivers/media/common/tuners/tda18271-common.c
+++ b/drivers/media/common/tuners/tda18271-common.c
@@ -227,9 +227,8 @@ int tda18271_charge_pump_source(struct dvb_frontend *fe,
227 227
228 regs[r_cp] &= ~0x20; 228 regs[r_cp] &= ~0x20;
229 regs[r_cp] |= ((force & 1) << 5); 229 regs[r_cp] |= ((force & 1) << 5);
230 tda18271_write_regs(fe, r_cp, 1);
231 230
232 return 0; 231 return tda18271_write_regs(fe, r_cp, 1);
233} 232}
234 233
235int tda18271_init_regs(struct dvb_frontend *fe) 234int tda18271_init_regs(struct dvb_frontend *fe)
@@ -494,9 +493,7 @@ int tda18271_set_standby_mode(struct dvb_frontend *fe,
494 sm_lt ? (1 << 6) : 0 | 493 sm_lt ? (1 << 6) : 0 |
495 sm_xt ? (1 << 5) : 0; 494 sm_xt ? (1 << 5) : 0;
496 495
497 tda18271_write_regs(fe, R_EP3, 1); 496 return tda18271_write_regs(fe, R_EP3, 1);
498
499 return 0;
500} 497}
501 498
502/*---------------------------------------------------------------------*/ 499/*---------------------------------------------------------------------*/
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c
index b262100ae897..46c080089eb0 100644
--- a/drivers/media/common/tuners/tda18271-fe.c
+++ b/drivers/media/common/tuners/tda18271-fe.c
@@ -719,45 +719,56 @@ static int tda18271_ir_cal_init(struct dvb_frontend *fe)
719{ 719{
720 struct tda18271_priv *priv = fe->tuner_priv; 720 struct tda18271_priv *priv = fe->tuner_priv;
721 unsigned char *regs = priv->tda18271_regs; 721 unsigned char *regs = priv->tda18271_regs;
722 int ret;
722 723
723 tda18271_read_regs(fe); 724 ret = tda18271_read_regs(fe);
725 if (ret < 0)
726 goto fail;
724 727
725 /* test IR_CAL_OK to see if we need init */ 728 /* test IR_CAL_OK to see if we need init */
726 if ((regs[R_EP1] & 0x08) == 0) 729 if ((regs[R_EP1] & 0x08) == 0)
727 tda18271_init_regs(fe); 730 ret = tda18271_init_regs(fe);
728 731fail:
729 return 0; 732 return ret;
730} 733}
731 734
732static int tda18271_init(struct dvb_frontend *fe) 735static int tda18271_init(struct dvb_frontend *fe)
733{ 736{
734 struct tda18271_priv *priv = fe->tuner_priv; 737 struct tda18271_priv *priv = fe->tuner_priv;
738 int ret;
735 739
736 mutex_lock(&priv->lock); 740 mutex_lock(&priv->lock);
737 741
738 /* power up */ 742 /* power up */
739 tda18271_set_standby_mode(fe, 0, 0, 0); 743 ret = tda18271_set_standby_mode(fe, 0, 0, 0);
744 if (ret < 0)
745 goto fail;
740 746
741 /* initialization */ 747 /* initialization */
742 tda18271_ir_cal_init(fe); 748 ret = tda18271_ir_cal_init(fe);
749 if (ret < 0)
750 goto fail;
743 751
744 if (priv->id == TDA18271HDC2) 752 if (priv->id == TDA18271HDC2)
745 tda18271c2_rf_cal_init(fe); 753 tda18271c2_rf_cal_init(fe);
746 754fail:
747 mutex_unlock(&priv->lock); 755 mutex_unlock(&priv->lock);
748 756
749 return 0; 757 return ret;
750} 758}
751 759
752static int tda18271_tune(struct dvb_frontend *fe, 760static int tda18271_tune(struct dvb_frontend *fe,
753 struct tda18271_std_map_item *map, u32 freq, u32 bw) 761 struct tda18271_std_map_item *map, u32 freq, u32 bw)
754{ 762{
755 struct tda18271_priv *priv = fe->tuner_priv; 763 struct tda18271_priv *priv = fe->tuner_priv;
764 int ret;
756 765
757 tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n", 766 tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n",
758 freq, map->if_freq, bw, map->agc_mode, map->std); 767 freq, map->if_freq, bw, map->agc_mode, map->std);
759 768
760 tda18271_init(fe); 769 ret = tda18271_init(fe);
770 if (ret < 0)
771 goto fail;
761 772
762 mutex_lock(&priv->lock); 773 mutex_lock(&priv->lock);
763 774
@@ -772,8 +783,8 @@ static int tda18271_tune(struct dvb_frontend *fe,
772 tda18271_channel_configuration(fe, map, freq, bw); 783 tda18271_channel_configuration(fe, map, freq, bw);
773 784
774 mutex_unlock(&priv->lock); 785 mutex_unlock(&priv->lock);
775 786fail:
776 return 0; 787 return ret;
777} 788}
778 789
779/* ------------------------------------------------------------------ */ 790/* ------------------------------------------------------------------ */
@@ -905,16 +916,17 @@ fail:
905static int tda18271_sleep(struct dvb_frontend *fe) 916static int tda18271_sleep(struct dvb_frontend *fe)
906{ 917{
907 struct tda18271_priv *priv = fe->tuner_priv; 918 struct tda18271_priv *priv = fe->tuner_priv;
919 int ret;
908 920
909 mutex_lock(&priv->lock); 921 mutex_lock(&priv->lock);
910 922
911 /* standby mode w/ slave tuner output 923 /* standby mode w/ slave tuner output
912 * & loop thru & xtal oscillator on */ 924 * & loop thru & xtal oscillator on */
913 tda18271_set_standby_mode(fe, 1, 0, 0); 925 ret = tda18271_set_standby_mode(fe, 1, 0, 0);
914 926
915 mutex_unlock(&priv->lock); 927 mutex_unlock(&priv->lock);
916 928
917 return 0; 929 return ret;
918} 930}
919 931
920static int tda18271_release(struct dvb_frontend *fe) 932static int tda18271_release(struct dvb_frontend *fe)