Commit 60a5a927 authored by Darron Broad's avatar Darron Broad Committed by Mauro Carvalho Chehab

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: default avatarDarron Broad <darron@kewl.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 2c9bcea1
......@@ -606,7 +606,7 @@ static int dvb_register(struct cx8802_dev *dev)
/* Get the first frontend */
fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
if (!fe0)
return -EINVAL;
goto frontend_detach;
/* multi-frontend gate control is undefined or defaults to fe0 */
dev->frontends.gate = 0;
......@@ -653,38 +653,35 @@ static int dvb_register(struct cx8802_dev *dev)
}
break;
case CX88_BOARD_HAUPPAUGE_HVR3000:
/* MFE frontend 1 */
mfe_shared = 1;
dev->frontends.gate = 2;
/* DVB-S init */
fe0->dvb.frontend = dvb_attach(cx24123_attach,
&hauppauge_novas_config,
&dev->core->i2c_adap);
&hauppauge_novas_config,
&dev->core->i2c_adap);
if (fe0->dvb.frontend) {
if (!dvb_attach(isl6421_attach, fe0->dvb.frontend,
&dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) {
dprintk( 1, "%s(): HVR3000 - DVB-S LNB Init: failed\n", __func__);
}
} else {
dprintk( 1, "%s(): HVR3000 - DVB-S Init: failed\n", __func__);
if (!dvb_attach(isl6421_attach,
fe0->dvb.frontend,
&dev->core->i2c_adap,
0x08, ISL6421_DCL, 0x00))
goto frontend_detach;
}
/* DVB-T init */
/* MFE frontend 2 */
fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2);
if (fe1) {
dev->frontends.gate = 2;
mfe_shared = 1;
fe1->dvb.frontend = dvb_attach(cx22702_attach,
&hauppauge_hvr_config,
&dev->core->i2c_adap);
if (fe1->dvb.frontend) {
fe1->dvb.frontend->id = 1;
if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend,
&dev->core->i2c_adap, 0x61,
TUNER_PHILIPS_FMD1216ME_MK3)) {
dprintk( 1, "%s(): HVR3000 - DVB-T misc Init: failed\n", __func__);
}
} 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__);
if (!fe1)
goto frontend_detach;
/* DVB-T init */
fe1->dvb.frontend = dvb_attach(cx22702_attach,
&hauppauge_hvr_config,
&dev->core->i2c_adap);
if (fe1->dvb.frontend) {
fe1->dvb.frontend->id = 1;
if (!dvb_attach(simple_tuner_attach,
fe1->dvb.frontend,
&dev->core->i2c_adap,
0x61, TUNER_PHILIPS_FMD1216ME_MK3))
goto frontend_detach;
}
break;
case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
......@@ -998,48 +995,47 @@ static int dvb_register(struct cx8802_dev *dev)
}
break;
case CX88_BOARD_HAUPPAUGE_HVR4000:
/* MFE frontend 1 */
mfe_shared = 1;
dev->frontends.gate = 2;
/* DVB-S/S2 Init */
fe0->dvb.frontend = dvb_attach(cx24116_attach,
&hauppauge_hvr4000_config,
&dev->core->i2c_adap);
&hauppauge_hvr4000_config,
&dev->core->i2c_adap);
if (fe0->dvb.frontend) {
if(!dvb_attach(isl6421_attach, fe0->dvb.frontend,
&dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) {
dprintk( 1, "%s(): HVR4000 - DVB-S LNB Init: failed\n", __func__);
}
} else {
dprintk( 1, "%s(): HVR4000 - DVB-S Init: failed\n", __func__);
if (!dvb_attach(isl6421_attach,
fe0->dvb.frontend,
&dev->core->i2c_adap,
0x08, ISL6421_DCL, 0x00))
goto frontend_detach;
}
/* DVB-T Init */
/* MFE frontend 2 */
fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2);
if (fe1) {
dev->frontends.gate = 2;
mfe_shared = 1;
fe1->dvb.frontend = dvb_attach(cx22702_attach,
&hauppauge_hvr_config,
&dev->core->i2c_adap);
if (fe1->dvb.frontend) {
fe1->dvb.frontend->id = 1;
if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend,
&dev->core->i2c_adap, 0x61,
TUNER_PHILIPS_FMD1216ME_MK3)) {
dprintk( 1, "%s(): HVR4000 - DVB-T misc Init: failed\n", __func__);
}
} 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__);
if (!fe1)
goto frontend_detach;
/* DVB-T Init */
fe1->dvb.frontend = dvb_attach(cx22702_attach,
&hauppauge_hvr_config,
&dev->core->i2c_adap);
if (fe1->dvb.frontend) {
fe1->dvb.frontend->id = 1;
if (!dvb_attach(simple_tuner_attach,
fe1->dvb.frontend,
&dev->core->i2c_adap,
0x61, TUNER_PHILIPS_FMD1216ME_MK3))
goto frontend_detach;
}
break;
case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
fe0->dvb.frontend = dvb_attach(cx24116_attach,
&hauppauge_hvr4000_config,
&dev->core->i2c_adap);
&hauppauge_hvr4000_config,
&dev->core->i2c_adap);
if (fe0->dvb.frontend) {
dvb_attach(isl6421_attach, fe0->dvb.frontend,
&dev->core->i2c_adap,
0x08, ISL6421_DCL, 0x00);
if (!dvb_attach(isl6421_attach,
fe0->dvb.frontend,
&dev->core->i2c_adap,
0x08, ISL6421_DCL, 0x00))
goto frontend_detach;
}
break;
case CX88_BOARD_PROF_6200:
......@@ -1095,7 +1091,7 @@ static int dvb_register(struct cx8802_dev *dev)
printk(KERN_ERR
"%s/2: frontend initialization failed\n",
core->name);
return -EINVAL;
goto frontend_detach;
}
/* define general-purpose callback pointer */
fe0->dvb.frontend->callback = cx88_tuner_callback;
......
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