Clean up and error out if dvb_net_init fails (for example when
running out of memory).

>From an audit of dvb_net_init callers, now that dvb_net_init
has learned to return a nonzero value from time to time.

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
 drivers/media/dvb/bt8xx/dvb-bt8xx.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c 
b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
index 6aa3b486e865..94e01b47784f 100644
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -779,7 +779,11 @@ static int __devinit dvb_bt8xx_load_card(struct 
dvb_bt8xx_card *card, u32 type)
                goto err_remove_mem_frontend;
        }
 
-       dvb_net_init(&card->dvb_adapter, &card->dvbnet, &card->demux.dmx);
+       result = dvb_net_init(&card->dvb_adapter, &card->dvbnet, 
&card->demux.dmx);
+       if (result < 0) {
+               printk("dvb_bt8xx: dvb_net_init failed (errno = %d)\n", result);
+               goto err_disconnect_frontend;
+       }
 
        tasklet_init(&card->bt->tasklet, dvb_bt8xx_task, (unsigned long) card);
 
@@ -787,6 +791,8 @@ static int __devinit dvb_bt8xx_load_card(struct 
dvb_bt8xx_card *card, u32 type)
 
        return 0;
 
+err_disconnect_frontend:
+       card->demux.dmx.disconnect_frontend(&card->demux.dmx);
 err_remove_mem_frontend:
        card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_mem);
 err_remove_hw_frontend:
-- 
1.7.8.2+next.20111228

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to