summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ngene
diff options
context:
space:
mode:
authorOliver Endriss <o.endriss@gmx.de>2011-01-10 06:36:14 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-21 20:31:44 -0300
commit8a484719c790772bc51c87c56323611752361bef (patch)
treeb59fa402d0f51b8b3271098b1bcd795c0777f176 /drivers/media/dvb/ngene
parent5fec18574fec3eaffcab596c1a4e943e2d413cc3 (diff)
[media] ngene: Clean-up driver initialisation (part 1)
If tuner initialisation failed, the frontend node was not removed. When the frontend was opened, a kernel oops occurred... This is the first step to improve error handling during initialisation. Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/ngene')
-rw-r--r--drivers/media/dvb/ngene/ngene-cards.c1
-rw-r--r--drivers/media/dvb/ngene/ngene-core.c35
2 files changed, 23 insertions, 13 deletions
diff --git a/drivers/media/dvb/ngene/ngene-cards.c b/drivers/media/dvb/ngene/ngene-cards.c
index 5e6b85c3c0f..fc93d1064d4 100644
--- a/drivers/media/dvb/ngene/ngene-cards.c
+++ b/drivers/media/dvb/ngene/ngene-cards.c
@@ -113,6 +113,7 @@ static int demod_attach_stv0900(struct ngene_channel *chan)
0, chan->dev->card_info->lnb[chan->number])) {
printk(KERN_ERR DEVICE_NAME ": No LNBH24 found!\n");
dvb_frontend_detach(chan->fe);
+ chan->fe = NULL;
return -ENODEV;
}
diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c
index 8764647e55f..831b7586e88 100644
--- a/drivers/media/dvb/ngene/ngene-core.c
+++ b/drivers/media/dvb/ngene/ngene-core.c
@@ -1482,23 +1482,32 @@ static int init_channel(struct ngene_channel *chan)
if (io & NGENE_IO_TSIN) {
chan->fe = NULL;
- if (ni->demod_attach[nr])
- ni->demod_attach[nr](chan);
+ if (ni->demod_attach[nr]) {
+ ret = ni->demod_attach[nr](chan);
+ if (ret < 0)
+ goto err_fe;
+ }
+ if (chan->fe && ni->tuner_attach[nr]) {
+ ret = ni->tuner_attach[nr](chan);
+ if (ret < 0)
+ goto err_fe;
+ }
if (chan->fe) {
- if (dvb_register_frontend(adapter, chan->fe) < 0) {
- if (chan->fe->ops.release)
- chan->fe->ops.release(chan->fe);
- chan->fe = NULL;
- }
+ if (dvb_register_frontend(adapter, chan->fe) < 0)
+ goto err_fe;
}
- if (chan->fe && ni->tuner_attach[nr])
- if (ni->tuner_attach[nr] (chan) < 0) {
- printk(KERN_ERR DEVICE_NAME
- ": Tuner attach failed on channel %d!\n",
- nr);
- }
}
return ret;
+
+err_fe:
+ if (chan->fe) {
+ dvb_frontend_detach(chan->fe);
+ chan->fe = NULL;
+ }
+/* FIXME: this causes an oops... */
+/* release_channel(chan); */
+/* return ret; */
+ return 0;
}
static int init_channels(struct ngene *dev)