diff options
author | Oliver Endriss <o.endriss@gmx.de> | 2011-01-10 04:36:14 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-21 19:31:44 -0400 |
commit | 8a484719c790772bc51c87c56323611752361bef (patch) | |
tree | b59fa402d0f51b8b3271098b1bcd795c0777f176 /drivers/media/dvb/ngene | |
parent | 5fec18574fec3eaffcab596c1a4e943e2d413cc3 (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.c | 1 | ||||
-rw-r--r-- | drivers/media/dvb/ngene/ngene-core.c | 35 |
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 5e6b85c3c0fc..fc93d1064d4e 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) | |||
113 | 0, chan->dev->card_info->lnb[chan->number])) { | 113 | 0, chan->dev->card_info->lnb[chan->number])) { |
114 | printk(KERN_ERR DEVICE_NAME ": No LNBH24 found!\n"); | 114 | printk(KERN_ERR DEVICE_NAME ": No LNBH24 found!\n"); |
115 | dvb_frontend_detach(chan->fe); | 115 | dvb_frontend_detach(chan->fe); |
116 | chan->fe = NULL; | ||
116 | return -ENODEV; | 117 | return -ENODEV; |
117 | } | 118 | } |
118 | 119 | ||
diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index 8764647e55f3..831b7586e88f 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) | |||
1482 | 1482 | ||
1483 | if (io & NGENE_IO_TSIN) { | 1483 | if (io & NGENE_IO_TSIN) { |
1484 | chan->fe = NULL; | 1484 | chan->fe = NULL; |
1485 | if (ni->demod_attach[nr]) | 1485 | if (ni->demod_attach[nr]) { |
1486 | ni->demod_attach[nr](chan); | 1486 | ret = ni->demod_attach[nr](chan); |
1487 | if (ret < 0) | ||
1488 | goto err_fe; | ||
1489 | } | ||
1490 | if (chan->fe && ni->tuner_attach[nr]) { | ||
1491 | ret = ni->tuner_attach[nr](chan); | ||
1492 | if (ret < 0) | ||
1493 | goto err_fe; | ||
1494 | } | ||
1487 | if (chan->fe) { | 1495 | if (chan->fe) { |
1488 | if (dvb_register_frontend(adapter, chan->fe) < 0) { | 1496 | if (dvb_register_frontend(adapter, chan->fe) < 0) |
1489 | if (chan->fe->ops.release) | 1497 | goto err_fe; |
1490 | chan->fe->ops.release(chan->fe); | ||
1491 | chan->fe = NULL; | ||
1492 | } | ||
1493 | } | 1498 | } |
1494 | if (chan->fe && ni->tuner_attach[nr]) | ||
1495 | if (ni->tuner_attach[nr] (chan) < 0) { | ||
1496 | printk(KERN_ERR DEVICE_NAME | ||
1497 | ": Tuner attach failed on channel %d!\n", | ||
1498 | nr); | ||
1499 | } | ||
1500 | } | 1499 | } |
1501 | return ret; | 1500 | return ret; |
1501 | |||
1502 | err_fe: | ||
1503 | if (chan->fe) { | ||
1504 | dvb_frontend_detach(chan->fe); | ||
1505 | chan->fe = NULL; | ||
1506 | } | ||
1507 | /* FIXME: this causes an oops... */ | ||
1508 | /* release_channel(chan); */ | ||
1509 | /* return ret; */ | ||
1510 | return 0; | ||
1502 | } | 1511 | } |
1503 | 1512 | ||
1504 | static int init_channels(struct ngene *dev) | 1513 | static int init_channels(struct ngene *dev) |