aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-04-20 11:01:47 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 00:59:38 -0400
commit6b3ccab75ce082f7d63a43903ebd75da4266f77e (patch)
tree866d08667706310aaf7151a9802595fb44a7b63f /drivers
parent159f8a6eda8c2ee359bb87bf62be70da2da14918 (diff)
V4L/DVB (3895): Additional frontend_init safety checks
Don't try and set the tuner ops if the demod was not detected. Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/ttpci/av7110.c24
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c4
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c116
3 files changed, 96 insertions, 48 deletions
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 939a493b5251..5f976d5eda42 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -2083,7 +2083,9 @@ static int frontend_init(struct av7110 *av7110)
2083 case 0x0000: // Fujitsu/Siemens DVB-Cable (ves1820/Philips CD1516(??)) 2083 case 0x0000: // Fujitsu/Siemens DVB-Cable (ves1820/Philips CD1516(??))
2084 av7110->fe = ves1820_attach(&philips_cd1516_config, 2084 av7110->fe = ves1820_attach(&philips_cd1516_config,
2085 &av7110->i2c_adap, read_pwm(av7110)); 2085 &av7110->i2c_adap, read_pwm(av7110));
2086 av7110->fe->ops->tuner_ops.set_params = philips_cd1516_tuner_set_params; 2086 if (av7110->fe) {
2087 av7110->fe->ops->tuner_ops.set_params = philips_cd1516_tuner_set_params;
2088 }
2087 break; 2089 break;
2088 } 2090 }
2089 2091
@@ -2134,13 +2136,17 @@ static int frontend_init(struct av7110 *av7110)
2134 /* Siemens DVB-C (full-length card) VES1820/Philips CD1516 */ 2136 /* Siemens DVB-C (full-length card) VES1820/Philips CD1516 */
2135 av7110->fe = ves1820_attach(&philips_cd1516_config, &av7110->i2c_adap, 2137 av7110->fe = ves1820_attach(&philips_cd1516_config, &av7110->i2c_adap,
2136 read_pwm(av7110)); 2138 read_pwm(av7110));
2137 av7110->fe->ops->tuner_ops.set_params = philips_cd1516_tuner_set_params; 2139 if (av7110->fe) {
2140 av7110->fe->ops->tuner_ops.set_params = philips_cd1516_tuner_set_params;
2141 }
2138 break; 2142 break;
2139 case 0x0003: 2143 case 0x0003:
2140 /* Hauppauge DVB-C 2.1 VES1820/ALPS TDBE2 */ 2144 /* Hauppauge DVB-C 2.1 VES1820/ALPS TDBE2 */
2141 av7110->fe = ves1820_attach(&alps_tdbe2_config, &av7110->i2c_adap, 2145 av7110->fe = ves1820_attach(&alps_tdbe2_config, &av7110->i2c_adap,
2142 read_pwm(av7110)); 2146 read_pwm(av7110));
2143 av7110->fe->ops->tuner_ops.set_params = alps_tdbe2_tuner_set_params; 2147 if (av7110->fe) {
2148 av7110->fe->ops->tuner_ops.set_params = alps_tdbe2_tuner_set_params;
2149 }
2144 break; 2150 break;
2145 } 2151 }
2146 break; 2152 break;
@@ -2149,13 +2155,17 @@ static int frontend_init(struct av7110 *av7110)
2149 2155
2150 // ALPS TDLB7 2156 // ALPS TDLB7
2151 av7110->fe = sp8870_attach(&alps_tdlb7_config, &av7110->i2c_adap); 2157 av7110->fe = sp8870_attach(&alps_tdlb7_config, &av7110->i2c_adap);
2152 av7110->fe->ops->tuner_ops.set_params = alps_tdlb7_tuner_set_params; 2158 if (av7110->fe) {
2159 av7110->fe->ops->tuner_ops.set_params = alps_tdlb7_tuner_set_params;
2160 }
2153 break; 2161 break;
2154 2162
2155 case 0x0002: // Hauppauge/TT DVB-C premium rev2.X 2163 case 0x0002: // Hauppauge/TT DVB-C premium rev2.X
2156 2164
2157 av7110->fe = ves1820_attach(&alps_tdbe2_config, &av7110->i2c_adap, read_pwm(av7110)); 2165 av7110->fe = ves1820_attach(&alps_tdbe2_config, &av7110->i2c_adap, read_pwm(av7110));
2158 av7110->fe->ops->tuner_ops.set_params = alps_tdbe2_tuner_set_params; 2166 if (av7110->fe) {
2167 av7110->fe->ops->tuner_ops.set_params = alps_tdbe2_tuner_set_params;
2168 }
2159 break; 2169 break;
2160 2170
2161 case 0x0004: // Galaxis DVB-S rev1.3 2171 case 0x0004: // Galaxis DVB-S rev1.3
@@ -2185,7 +2195,9 @@ static int frontend_init(struct av7110 *av7110)
2185 case 0x0008: // Hauppauge/TT DVB-T 2195 case 0x0008: // Hauppauge/TT DVB-T
2186 2196
2187 av7110->fe = l64781_attach(&grundig_29504_401_config, &av7110->i2c_adap); 2197 av7110->fe = l64781_attach(&grundig_29504_401_config, &av7110->i2c_adap);
2188 av7110->fe->ops->tuner_ops.set_params = grundig_29504_401_tuner_set_params; 2198 if (av7110->fe) {
2199 av7110->fe->ops->tuner_ops.set_params = grundig_29504_401_tuner_set_params;
2200 }
2189 break; 2201 break;
2190 2202
2191 case 0x000A: // Hauppauge/TT Nexus-CA rev1.X 2203 case 0x000A: // Hauppauge/TT Nexus-CA rev1.X
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 9bd069e4e11a..68004187860f 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -1113,6 +1113,10 @@ static void frontend_init(struct budget_av *budget_av)
1113 case SUBID_DVBT_CINERGY1200: 1113 case SUBID_DVBT_CINERGY1200:
1114 fe = tda10046_attach(&philips_tu1216_config, 1114 fe = tda10046_attach(&philips_tu1216_config,
1115 &budget_av->budget.i2c_adap); 1115 &budget_av->budget.i2c_adap);
1116 if (fe) {
1117 fe->ops->tuner_ops.init = philips_tu1216_tuner_init;
1118 fe->ops->tuner_ops.set_params = philips_tu1216_tuner_set_params;
1119 }
1116 break; 1120 break;
1117 } 1121 }
1118 1122
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index d62e9a4f2a1c..a83db2abb449 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1020,112 +1020,144 @@ static int dvb_init(struct saa7134_dev *dev)
1020 printk("%s: pinnacle 300i dvb setup\n",dev->name); 1020 printk("%s: pinnacle 300i dvb setup\n",dev->name);
1021 dev->dvb.frontend = mt352_attach(&pinnacle_300i, 1021 dev->dvb.frontend = mt352_attach(&pinnacle_300i,
1022 &dev->i2c_adap); 1022 &dev->i2c_adap);
1023 dev->dvb.frontend->ops->tuner_ops.calc_regs = mt352_pinnacle_tuner_calc_regs; 1023 if (dev->dvb.frontend) {
1024 dev->dvb.frontend->ops->tuner_ops.calc_regs = mt352_pinnacle_tuner_calc_regs;
1025 }
1024 break; 1026 break;
1025 1027
1026 case SAA7134_BOARD_AVERMEDIA_777: 1028 case SAA7134_BOARD_AVERMEDIA_777:
1027 printk("%s: avertv 777 dvb setup\n",dev->name); 1029 printk("%s: avertv 777 dvb setup\n",dev->name);
1028 dev->dvb.frontend = mt352_attach(&avermedia_777, 1030 dev->dvb.frontend = mt352_attach(&avermedia_777,
1029 &dev->i2c_adap); 1031 &dev->i2c_adap);
1030 dev->dvb.frontend->ops->tuner_ops.calc_regs = mt352_aver777_tuner_calc_regs; 1032 if (dev->dvb.frontend) {
1033 dev->dvb.frontend->ops->tuner_ops.calc_regs = mt352_aver777_tuner_calc_regs;
1034 }
1031 break; 1035 break;
1032#endif 1036#endif
1033#ifdef HAVE_TDA1004X 1037#ifdef HAVE_TDA1004X
1034 case SAA7134_BOARD_MD7134: 1038 case SAA7134_BOARD_MD7134:
1035 dev->dvb.frontend = tda10046_attach(&medion_cardbus, 1039 dev->dvb.frontend = tda10046_attach(&medion_cardbus,
1036 &dev->i2c_adap); 1040 &dev->i2c_adap);
1037 dev->dvb.frontend->ops->tuner_ops.init = philips_fmd1216_tuner_init; 1041 if (dev->dvb.frontend) {
1038 dev->dvb.frontend->ops->tuner_ops.sleep = philips_fmd1216_tuner_sleep; 1042 dev->dvb.frontend->ops->tuner_ops.init = philips_fmd1216_tuner_init;
1039 dev->dvb.frontend->ops->tuner_ops.set_params = philips_fmd1216_tuner_set_params; 1043 dev->dvb.frontend->ops->tuner_ops.sleep = philips_fmd1216_tuner_sleep;
1044 dev->dvb.frontend->ops->tuner_ops.set_params = philips_fmd1216_tuner_set_params;
1045 }
1040 break; 1046 break;
1041 case SAA7134_BOARD_PHILIPS_TOUGH: 1047 case SAA7134_BOARD_PHILIPS_TOUGH:
1042 dev->dvb.frontend = tda10046_attach(&philips_tu1216_60_config, 1048 dev->dvb.frontend = tda10046_attach(&philips_tu1216_60_config,
1043 &dev->i2c_adap); 1049 &dev->i2c_adap);
1044 dev->dvb.frontend->ops->tuner_ops.init = philips_tu1216_tuner_60_init; 1050 if (dev->dvb.frontend) {
1045 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tu1216_tuner_60_set_params; 1051 dev->dvb.frontend->ops->tuner_ops.init = philips_tu1216_tuner_60_init;
1052 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tu1216_tuner_60_set_params;
1053 }
1046 break; 1054 break;
1047 case SAA7134_BOARD_FLYDVBTDUO: 1055 case SAA7134_BOARD_FLYDVBTDUO:
1048 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, 1056 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
1049 &dev->i2c_adap); 1057 &dev->i2c_adap);
1050 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init; 1058 if (dev->dvb.frontend) {
1051 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep; 1059 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init;
1052 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params; 1060 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep;
1061 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params;
1062 }
1053 break; 1063 break;
1054 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: 1064 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:
1055 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, 1065 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
1056 &dev->i2c_adap); 1066 &dev->i2c_adap);
1057 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init; 1067 if (dev->dvb.frontend) {
1058 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep; 1068 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init;
1059 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params; 1069 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep;
1070 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params;
1071 }
1060 break; 1072 break;
1061 case SAA7134_BOARD_PHILIPS_EUROPA: 1073 case SAA7134_BOARD_PHILIPS_EUROPA:
1062 dev->dvb.frontend = tda10046_attach(&philips_europa_config, 1074 dev->dvb.frontend = tda10046_attach(&philips_europa_config,
1063 &dev->i2c_adap); 1075 &dev->i2c_adap);
1064 dev->original_demod_sleep = dev->dvb.frontend->ops->sleep; 1076 if (dev->dvb.frontend) {
1065 dev->dvb.frontend->ops->sleep = philips_europa_demod_sleep; 1077 dev->original_demod_sleep = dev->dvb.frontend->ops->sleep;
1066 dev->dvb.frontend->ops->tuner_ops.init = philips_europa_tuner_init; 1078 dev->dvb.frontend->ops->sleep = philips_europa_demod_sleep;
1067 dev->dvb.frontend->ops->tuner_ops.sleep = philips_europa_tuner_sleep; 1079 dev->dvb.frontend->ops->tuner_ops.init = philips_europa_tuner_init;
1068 dev->dvb.frontend->ops->tuner_ops.set_params = philips_td1316_tuner_set_params; 1080 dev->dvb.frontend->ops->tuner_ops.sleep = philips_europa_tuner_sleep;
1081 dev->dvb.frontend->ops->tuner_ops.set_params = philips_td1316_tuner_set_params;
1082 }
1069 break; 1083 break;
1070 case SAA7134_BOARD_VIDEOMATE_DVBT_300: 1084 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
1071 dev->dvb.frontend = tda10046_attach(&philips_europa_config, 1085 dev->dvb.frontend = tda10046_attach(&philips_europa_config,
1072 &dev->i2c_adap); 1086 &dev->i2c_adap);
1073 dev->dvb.frontend->ops->tuner_ops.init = philips_europa_tuner_init; 1087 if (dev->dvb.frontend) {
1074 dev->dvb.frontend->ops->tuner_ops.sleep = philips_europa_tuner_sleep; 1088 dev->dvb.frontend->ops->tuner_ops.init = philips_europa_tuner_init;
1075 dev->dvb.frontend->ops->tuner_ops.set_params = philips_td1316_tuner_set_params; 1089 dev->dvb.frontend->ops->tuner_ops.sleep = philips_europa_tuner_sleep;
1090 dev->dvb.frontend->ops->tuner_ops.set_params = philips_td1316_tuner_set_params;
1091 }
1076 break; 1092 break;
1077 case SAA7134_BOARD_VIDEOMATE_DVBT_200: 1093 case SAA7134_BOARD_VIDEOMATE_DVBT_200:
1078 dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config, 1094 dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config,
1079 &dev->i2c_adap); 1095 &dev->i2c_adap);
1080 dev->dvb.frontend->ops->tuner_ops.init = philips_tu1216_tuner_61_init; 1096 if (dev->dvb.frontend) {
1081 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tu1216_tuner_61_set_params; 1097 dev->dvb.frontend->ops->tuner_ops.init = philips_tu1216_tuner_61_init;
1098 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tu1216_tuner_61_set_params;
1099 }
1082 break; 1100 break;
1083 case SAA7134_BOARD_PHILIPS_TIGER: 1101 case SAA7134_BOARD_PHILIPS_TIGER:
1084 dev->dvb.frontend = tda10046_attach(&philips_tiger_config, 1102 dev->dvb.frontend = tda10046_attach(&philips_tiger_config,
1085 &dev->i2c_adap); 1103 &dev->i2c_adap);
1086 dev->dvb.frontend->ops->tuner_ops.init = philips_tiger_tuner_init; 1104 if (dev->dvb.frontend) {
1087 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tiger_tuner_sleep; 1105 dev->dvb.frontend->ops->tuner_ops.init = philips_tiger_tuner_init;
1088 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tiger_tuner_set_params; 1106 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tiger_tuner_sleep;
1107 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tiger_tuner_set_params;
1108 }
1089 break; 1109 break;
1090 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 1110 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
1091 dev->dvb.frontend = tda10046_attach(&philips_tiger_config, 1111 dev->dvb.frontend = tda10046_attach(&philips_tiger_config,
1092 &dev->i2c_adap); 1112 &dev->i2c_adap);
1093 dev->dvb.frontend->ops->tuner_ops.init = philips_tiger_tuner_init; 1113 if (dev->dvb.frontend) {
1094 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tiger_tuner_sleep; 1114 dev->dvb.frontend->ops->tuner_ops.init = philips_tiger_tuner_init;
1095 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tiger_tuner_set_params; 1115 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tiger_tuner_sleep;
1116 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tiger_tuner_set_params;
1117 }
1096 break; 1118 break;
1097 case SAA7134_BOARD_FLYDVBT_LR301: 1119 case SAA7134_BOARD_FLYDVBT_LR301:
1098 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, 1120 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
1099 &dev->i2c_adap); 1121 &dev->i2c_adap);
1100 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init; 1122 if (dev->dvb.frontend) {
1101 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep; 1123 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init;
1102 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params; 1124 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep;
1125 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params;
1126 }
1103 break; 1127 break;
1104 case SAA7134_BOARD_FLYDVB_TRIO: 1128 case SAA7134_BOARD_FLYDVB_TRIO:
1105 dev->dvb.frontend = tda10046_attach(&lifeview_trio_config, 1129 dev->dvb.frontend = tda10046_attach(&lifeview_trio_config,
1106 &dev->i2c_adap); 1130 &dev->i2c_adap);
1107 dev->dvb.frontend->ops->tuner_ops.sleep = lifeview_trio_tuner_sleep; 1131 if (dev->dvb.frontend) {
1108 dev->dvb.frontend->ops->tuner_ops.set_params = lifeview_trio_tuner_set_params; 1132 dev->dvb.frontend->ops->tuner_ops.sleep = lifeview_trio_tuner_sleep;
1133 dev->dvb.frontend->ops->tuner_ops.set_params = lifeview_trio_tuner_set_params;
1134 }
1109 break; 1135 break;
1110 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: 1136 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
1111 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, 1137 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config,
1112 &dev->i2c_adap); 1138 &dev->i2c_adap);
1113 dev->dvb.frontend->ops->tuner_ops.init = ads_duo_tuner_init; 1139 if (dev->dvb.frontend) {
1114 dev->dvb.frontend->ops->tuner_ops.sleep = ads_duo_tuner_sleep; 1140 dev->dvb.frontend->ops->tuner_ops.init = ads_duo_tuner_init;
1115 dev->dvb.frontend->ops->tuner_ops.set_params = ads_duo_tuner_set_params; 1141 dev->dvb.frontend->ops->tuner_ops.sleep = ads_duo_tuner_sleep;
1142 dev->dvb.frontend->ops->tuner_ops.set_params = ads_duo_tuner_set_params;
1143 }
1116 break; 1144 break;
1117 case SAA7134_BOARD_TEVION_DVBT_220RF: 1145 case SAA7134_BOARD_TEVION_DVBT_220RF:
1118 dev->dvb.frontend = tda10046_attach(&tevion_dvbt220rf_config, 1146 dev->dvb.frontend = tda10046_attach(&tevion_dvbt220rf_config,
1119 &dev->i2c_adap); 1147 &dev->i2c_adap);
1120 dev->dvb.frontend->ops->tuner_ops.sleep = tevion_dvb220rf_tuner_sleep; 1148 if (dev->dvb.frontend) {
1121 dev->dvb.frontend->ops->tuner_ops.set_params = tevion_dvb220rf_tuner_set_params; 1149 dev->dvb.frontend->ops->tuner_ops.sleep = tevion_dvb220rf_tuner_sleep;
1150 dev->dvb.frontend->ops->tuner_ops.set_params = tevion_dvb220rf_tuner_set_params;
1151 }
1122 break; 1152 break;
1123 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: 1153 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS:
1124 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, 1154 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config,
1125 &dev->i2c_adap); 1155 &dev->i2c_adap);
1126 dev->dvb.frontend->ops->tuner_ops.init = ads_duo_tuner_init; 1156 if (dev->dvb.frontend) {
1127 dev->dvb.frontend->ops->tuner_ops.sleep = ads_duo_tuner_sleep; 1157 dev->dvb.frontend->ops->tuner_ops.init = ads_duo_tuner_init;
1128 dev->dvb.frontend->ops->tuner_ops.set_params = ads_duo_tuner_set_params; 1158 dev->dvb.frontend->ops->tuner_ops.sleep = ads_duo_tuner_sleep;
1159 dev->dvb.frontend->ops->tuner_ops.set_params = ads_duo_tuner_set_params;
1160 }
1129 break; 1161 break;
1130#endif 1162#endif
1131#ifdef HAVE_NXT200X 1163#ifdef HAVE_NXT200X