V4L/DVB (9576): cx88-dvb: MFE attachment clean-up for HVR-3000/4000
This cleans-up MFE attachment for these cards plus two cases of potential memory leak on attachment failure. Signed-off-by: Darron Broad <darron@kewl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
2c9bcea1a1
commit
60a5a92759
|
@ -606,7 +606,7 @@ static int dvb_register(struct cx8802_dev *dev)
|
||||||
/* Get the first frontend */
|
/* Get the first frontend */
|
||||||
fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
|
fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
|
||||||
if (!fe0)
|
if (!fe0)
|
||||||
return -EINVAL;
|
goto frontend_detach;
|
||||||
|
|
||||||
/* multi-frontend gate control is undefined or defaults to fe0 */
|
/* multi-frontend gate control is undefined or defaults to fe0 */
|
||||||
dev->frontends.gate = 0;
|
dev->frontends.gate = 0;
|
||||||
|
@ -653,38 +653,35 @@ static int dvb_register(struct cx8802_dev *dev)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CX88_BOARD_HAUPPAUGE_HVR3000:
|
case CX88_BOARD_HAUPPAUGE_HVR3000:
|
||||||
|
/* MFE frontend 1 */
|
||||||
|
mfe_shared = 1;
|
||||||
|
dev->frontends.gate = 2;
|
||||||
/* DVB-S init */
|
/* DVB-S init */
|
||||||
fe0->dvb.frontend = dvb_attach(cx24123_attach,
|
fe0->dvb.frontend = dvb_attach(cx24123_attach,
|
||||||
&hauppauge_novas_config,
|
&hauppauge_novas_config,
|
||||||
&dev->core->i2c_adap);
|
&dev->core->i2c_adap);
|
||||||
if (fe0->dvb.frontend) {
|
if (fe0->dvb.frontend) {
|
||||||
if (!dvb_attach(isl6421_attach, fe0->dvb.frontend,
|
if (!dvb_attach(isl6421_attach,
|
||||||
&dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) {
|
fe0->dvb.frontend,
|
||||||
dprintk( 1, "%s(): HVR3000 - DVB-S LNB Init: failed\n", __func__);
|
&dev->core->i2c_adap,
|
||||||
|
0x08, ISL6421_DCL, 0x00))
|
||||||
|
goto frontend_detach;
|
||||||
}
|
}
|
||||||
} else {
|
/* MFE frontend 2 */
|
||||||
dprintk( 1, "%s(): HVR3000 - DVB-S Init: failed\n", __func__);
|
|
||||||
}
|
|
||||||
/* DVB-T init */
|
|
||||||
fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2);
|
fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2);
|
||||||
if (fe1) {
|
if (!fe1)
|
||||||
dev->frontends.gate = 2;
|
goto frontend_detach;
|
||||||
mfe_shared = 1;
|
/* DVB-T init */
|
||||||
fe1->dvb.frontend = dvb_attach(cx22702_attach,
|
fe1->dvb.frontend = dvb_attach(cx22702_attach,
|
||||||
&hauppauge_hvr_config,
|
&hauppauge_hvr_config,
|
||||||
&dev->core->i2c_adap);
|
&dev->core->i2c_adap);
|
||||||
if (fe1->dvb.frontend) {
|
if (fe1->dvb.frontend) {
|
||||||
fe1->dvb.frontend->id = 1;
|
fe1->dvb.frontend->id = 1;
|
||||||
if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend,
|
if (!dvb_attach(simple_tuner_attach,
|
||||||
&dev->core->i2c_adap, 0x61,
|
fe1->dvb.frontend,
|
||||||
TUNER_PHILIPS_FMD1216ME_MK3)) {
|
&dev->core->i2c_adap,
|
||||||
dprintk( 1, "%s(): HVR3000 - DVB-T misc Init: failed\n", __func__);
|
0x61, TUNER_PHILIPS_FMD1216ME_MK3))
|
||||||
}
|
goto frontend_detach;
|
||||||
} else {
|
|
||||||
dprintk( 1, "%s(): HVR3000 - DVB-T Init: failed\n", __func__);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dprintk( 1, "%s(): HVR3000 - DVB-T Init: can't find frontend 2.\n", __func__);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
|
case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
|
||||||
|
@ -998,38 +995,35 @@ static int dvb_register(struct cx8802_dev *dev)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CX88_BOARD_HAUPPAUGE_HVR4000:
|
case CX88_BOARD_HAUPPAUGE_HVR4000:
|
||||||
|
/* MFE frontend 1 */
|
||||||
|
mfe_shared = 1;
|
||||||
|
dev->frontends.gate = 2;
|
||||||
/* DVB-S/S2 Init */
|
/* DVB-S/S2 Init */
|
||||||
fe0->dvb.frontend = dvb_attach(cx24116_attach,
|
fe0->dvb.frontend = dvb_attach(cx24116_attach,
|
||||||
&hauppauge_hvr4000_config,
|
&hauppauge_hvr4000_config,
|
||||||
&dev->core->i2c_adap);
|
&dev->core->i2c_adap);
|
||||||
if (fe0->dvb.frontend) {
|
if (fe0->dvb.frontend) {
|
||||||
if(!dvb_attach(isl6421_attach, fe0->dvb.frontend,
|
if (!dvb_attach(isl6421_attach,
|
||||||
&dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) {
|
fe0->dvb.frontend,
|
||||||
dprintk( 1, "%s(): HVR4000 - DVB-S LNB Init: failed\n", __func__);
|
&dev->core->i2c_adap,
|
||||||
|
0x08, ISL6421_DCL, 0x00))
|
||||||
|
goto frontend_detach;
|
||||||
}
|
}
|
||||||
} else {
|
/* MFE frontend 2 */
|
||||||
dprintk( 1, "%s(): HVR4000 - DVB-S Init: failed\n", __func__);
|
|
||||||
}
|
|
||||||
/* DVB-T Init */
|
|
||||||
fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2);
|
fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2);
|
||||||
if (fe1) {
|
if (!fe1)
|
||||||
dev->frontends.gate = 2;
|
goto frontend_detach;
|
||||||
mfe_shared = 1;
|
/* DVB-T Init */
|
||||||
fe1->dvb.frontend = dvb_attach(cx22702_attach,
|
fe1->dvb.frontend = dvb_attach(cx22702_attach,
|
||||||
&hauppauge_hvr_config,
|
&hauppauge_hvr_config,
|
||||||
&dev->core->i2c_adap);
|
&dev->core->i2c_adap);
|
||||||
if (fe1->dvb.frontend) {
|
if (fe1->dvb.frontend) {
|
||||||
fe1->dvb.frontend->id = 1;
|
fe1->dvb.frontend->id = 1;
|
||||||
if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend,
|
if (!dvb_attach(simple_tuner_attach,
|
||||||
&dev->core->i2c_adap, 0x61,
|
fe1->dvb.frontend,
|
||||||
TUNER_PHILIPS_FMD1216ME_MK3)) {
|
&dev->core->i2c_adap,
|
||||||
dprintk( 1, "%s(): HVR4000 - DVB-T misc Init: failed\n", __func__);
|
0x61, TUNER_PHILIPS_FMD1216ME_MK3))
|
||||||
}
|
goto frontend_detach;
|
||||||
} else {
|
|
||||||
dprintk( 1, "%s(): HVR4000 - DVB-T Init: failed\n", __func__);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dprintk( 1, "%s(): HVR4000 - DVB-T Init: can't find frontend 2.\n", __func__);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
|
case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
|
||||||
|
@ -1037,9 +1031,11 @@ static int dvb_register(struct cx8802_dev *dev)
|
||||||
&hauppauge_hvr4000_config,
|
&hauppauge_hvr4000_config,
|
||||||
&dev->core->i2c_adap);
|
&dev->core->i2c_adap);
|
||||||
if (fe0->dvb.frontend) {
|
if (fe0->dvb.frontend) {
|
||||||
dvb_attach(isl6421_attach, fe0->dvb.frontend,
|
if (!dvb_attach(isl6421_attach,
|
||||||
|
fe0->dvb.frontend,
|
||||||
&dev->core->i2c_adap,
|
&dev->core->i2c_adap,
|
||||||
0x08, ISL6421_DCL, 0x00);
|
0x08, ISL6421_DCL, 0x00))
|
||||||
|
goto frontend_detach;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CX88_BOARD_PROF_6200:
|
case CX88_BOARD_PROF_6200:
|
||||||
|
@ -1095,7 +1091,7 @@ static int dvb_register(struct cx8802_dev *dev)
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR
|
||||||
"%s/2: frontend initialization failed\n",
|
"%s/2: frontend initialization failed\n",
|
||||||
core->name);
|
core->name);
|
||||||
return -EINVAL;
|
goto frontend_detach;
|
||||||
}
|
}
|
||||||
/* define general-purpose callback pointer */
|
/* define general-purpose callback pointer */
|
||||||
fe0->dvb.frontend->callback = cx88_tuner_callback;
|
fe0->dvb.frontend->callback = cx88_tuner_callback;
|
||||||
|
|
Loading…
Reference in New Issue