aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88
diff options
context:
space:
mode:
authorDarron Broad <darron@kewl.org>2008-11-11 06:48:27 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:31 -0500
commit60a5a927595763dbb711a13528e21c2b7a46dbad (patch)
treede6b44a379b5af59d26823902bacc34c0b4bba8f /drivers/media/video/cx88
parent2c9bcea1a11134a47a46b6b61aeac5f06296d152 (diff)
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>
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c118
1 files changed, 57 insertions, 61 deletions
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 462947319dda..e5bbc7b37c39 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -606,7 +606,7 @@ static int dvb_register(struct cx8802_dev *dev)
606 /* Get the first frontend */ 606 /* Get the first frontend */
607 fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); 607 fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
608 if (!fe0) 608 if (!fe0)
609 return -EINVAL; 609 goto frontend_detach;
610 610
611 /* multi-frontend gate control is undefined or defaults to fe0 */ 611 /* multi-frontend gate control is undefined or defaults to fe0 */
612 dev->frontends.gate = 0; 612 dev->frontends.gate = 0;
@@ -653,38 +653,35 @@ static int dvb_register(struct cx8802_dev *dev)
653 } 653 }
654 break; 654 break;
655 case CX88_BOARD_HAUPPAUGE_HVR3000: 655 case CX88_BOARD_HAUPPAUGE_HVR3000:
656 /* MFE frontend 1 */
657 mfe_shared = 1;
658 dev->frontends.gate = 2;
656 /* DVB-S init */ 659 /* DVB-S init */
657 fe0->dvb.frontend = dvb_attach(cx24123_attach, 660 fe0->dvb.frontend = dvb_attach(cx24123_attach,
658 &hauppauge_novas_config, 661 &hauppauge_novas_config,
659 &dev->core->i2c_adap); 662 &dev->core->i2c_adap);
660 if (fe0->dvb.frontend) { 663 if (fe0->dvb.frontend) {
661 if (!dvb_attach(isl6421_attach, fe0->dvb.frontend, 664 if (!dvb_attach(isl6421_attach,
662 &dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) { 665 fe0->dvb.frontend,
663 dprintk( 1, "%s(): HVR3000 - DVB-S LNB Init: failed\n", __func__); 666 &dev->core->i2c_adap,
664 } 667 0x08, ISL6421_DCL, 0x00))
665 } else { 668 goto frontend_detach;
666 dprintk( 1, "%s(): HVR3000 - DVB-S Init: failed\n", __func__);
667 } 669 }
668 /* DVB-T init */ 670 /* MFE frontend 2 */
669 fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); 671 fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2);
670 if (fe1) { 672 if (!fe1)
671 dev->frontends.gate = 2; 673 goto frontend_detach;
672 mfe_shared = 1; 674 /* DVB-T init */
673 fe1->dvb.frontend = dvb_attach(cx22702_attach, 675 fe1->dvb.frontend = dvb_attach(cx22702_attach,
674 &hauppauge_hvr_config, 676 &hauppauge_hvr_config,
675 &dev->core->i2c_adap); 677 &dev->core->i2c_adap);
676 if (fe1->dvb.frontend) { 678 if (fe1->dvb.frontend) {
677 fe1->dvb.frontend->id = 1; 679 fe1->dvb.frontend->id = 1;
678 if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend, 680 if (!dvb_attach(simple_tuner_attach,
679 &dev->core->i2c_adap, 0x61, 681 fe1->dvb.frontend,
680 TUNER_PHILIPS_FMD1216ME_MK3)) { 682 &dev->core->i2c_adap,
681 dprintk( 1, "%s(): HVR3000 - DVB-T misc Init: failed\n", __func__); 683 0x61, TUNER_PHILIPS_FMD1216ME_MK3))
682 } 684 goto frontend_detach;
683 } else {
684 dprintk( 1, "%s(): HVR3000 - DVB-T Init: failed\n", __func__);
685 }
686 } else {
687 dprintk( 1, "%s(): HVR3000 - DVB-T Init: can't find frontend 2.\n", __func__);
688 } 685 }
689 break; 686 break;
690 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: 687 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
@@ -998,48 +995,47 @@ static int dvb_register(struct cx8802_dev *dev)
998 } 995 }
999 break; 996 break;
1000 case CX88_BOARD_HAUPPAUGE_HVR4000: 997 case CX88_BOARD_HAUPPAUGE_HVR4000:
998 /* MFE frontend 1 */
999 mfe_shared = 1;
1000 dev->frontends.gate = 2;
1001 /* DVB-S/S2 Init */ 1001 /* DVB-S/S2 Init */
1002 fe0->dvb.frontend = dvb_attach(cx24116_attach, 1002 fe0->dvb.frontend = dvb_attach(cx24116_attach,
1003 &hauppauge_hvr4000_config, 1003 &hauppauge_hvr4000_config,
1004 &dev->core->i2c_adap); 1004 &dev->core->i2c_adap);
1005 if (fe0->dvb.frontend) { 1005 if (fe0->dvb.frontend) {
1006 if(!dvb_attach(isl6421_attach, fe0->dvb.frontend, 1006 if (!dvb_attach(isl6421_attach,
1007 &dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) { 1007 fe0->dvb.frontend,
1008 dprintk( 1, "%s(): HVR4000 - DVB-S LNB Init: failed\n", __func__); 1008 &dev->core->i2c_adap,
1009 } 1009 0x08, ISL6421_DCL, 0x00))
1010 } else { 1010 goto frontend_detach;
1011 dprintk( 1, "%s(): HVR4000 - DVB-S Init: failed\n", __func__);
1012 } 1011 }
1013 /* DVB-T Init */ 1012 /* MFE frontend 2 */
1014 fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); 1013 fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2);
1015 if (fe1) { 1014 if (!fe1)
1016 dev->frontends.gate = 2; 1015 goto frontend_detach;
1017 mfe_shared = 1; 1016 /* DVB-T Init */
1018 fe1->dvb.frontend = dvb_attach(cx22702_attach, 1017 fe1->dvb.frontend = dvb_attach(cx22702_attach,
1019 &hauppauge_hvr_config, 1018 &hauppauge_hvr_config,
1020 &dev->core->i2c_adap); 1019 &dev->core->i2c_adap);
1021 if (fe1->dvb.frontend) { 1020 if (fe1->dvb.frontend) {
1022 fe1->dvb.frontend->id = 1; 1021 fe1->dvb.frontend->id = 1;
1023 if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend, 1022 if (!dvb_attach(simple_tuner_attach,
1024 &dev->core->i2c_adap, 0x61, 1023 fe1->dvb.frontend,
1025 TUNER_PHILIPS_FMD1216ME_MK3)) { 1024 &dev->core->i2c_adap,
1026 dprintk( 1, "%s(): HVR4000 - DVB-T misc Init: failed\n", __func__); 1025 0x61, TUNER_PHILIPS_FMD1216ME_MK3))
1027 } 1026 goto frontend_detach;
1028 } else {
1029 dprintk( 1, "%s(): HVR4000 - DVB-T Init: failed\n", __func__);
1030 }
1031 } else {
1032 dprintk( 1, "%s(): HVR4000 - DVB-T Init: can't find frontend 2.\n", __func__);
1033 } 1027 }
1034 break; 1028 break;
1035 case CX88_BOARD_HAUPPAUGE_HVR4000LITE: 1029 case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
1036 fe0->dvb.frontend = dvb_attach(cx24116_attach, 1030 fe0->dvb.frontend = dvb_attach(cx24116_attach,
1037 &hauppauge_hvr4000_config, 1031 &hauppauge_hvr4000_config,
1038 &dev->core->i2c_adap); 1032 &dev->core->i2c_adap);
1039 if (fe0->dvb.frontend) { 1033 if (fe0->dvb.frontend) {
1040 dvb_attach(isl6421_attach, fe0->dvb.frontend, 1034 if (!dvb_attach(isl6421_attach,
1041 &dev->core->i2c_adap, 1035 fe0->dvb.frontend,
1042 0x08, ISL6421_DCL, 0x00); 1036 &dev->core->i2c_adap,
1037 0x08, ISL6421_DCL, 0x00))
1038 goto frontend_detach;
1043 } 1039 }
1044 break; 1040 break;
1045 case CX88_BOARD_PROF_6200: 1041 case CX88_BOARD_PROF_6200:
@@ -1095,7 +1091,7 @@ static int dvb_register(struct cx8802_dev *dev)
1095 printk(KERN_ERR 1091 printk(KERN_ERR
1096 "%s/2: frontend initialization failed\n", 1092 "%s/2: frontend initialization failed\n",
1097 core->name); 1093 core->name);
1098 return -EINVAL; 1094 goto frontend_detach;
1099 } 1095 }
1100 /* define general-purpose callback pointer */ 1096 /* define general-purpose callback pointer */
1101 fe0->dvb.frontend->callback = cx88_tuner_callback; 1097 fe0->dvb.frontend->callback = cx88_tuner_callback;