[media] flexcop: handle errors from dvb_net_init
authorJonathan Nieder <jrnieder@gmail.com>
Sat, 31 Dec 2011 11:04:25 +0000 (08:04 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 6 Jan 2012 14:46:58 +0000 (12:46 -0200)
Bail out if dvb_net_init encounters an error (for example an
out-of-memory condition), now that it reports them.

[mchehab@redhat.com: CodingStyle fix: don't use  "if ((ret = foo()) < 0)"]
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/b2c2/flexcop.c

index 2df1b0214dcdce8bbb139990c18b74c8f9cc5a7b..4d3caca466fdd9e62c0efd76b9f1c85d5d5387d5 100644 (file)
@@ -117,11 +117,17 @@ static int flexcop_dvb_init(struct flexcop_device *fc)
                goto err_connect_frontend;
        }
 
-       dvb_net_init(&fc->dvb_adapter, &fc->dvbnet, &fc->demux.dmx);
+       ret = dvb_net_init(&fc->dvb_adapter, &fc->dvbnet, &fc->demux.dmx);
+       if (ret < 0) {
+               err("dvb_net_init failed: error %d", ret);
+               goto err_net;
+       }
 
        fc->init_state |= FC_STATE_DVB_INIT;
        return 0;
 
+err_net:
+       fc->demux.dmx.disconnect_frontend(&fc->demux.dmx);
 err_connect_frontend:
        fc->demux.dmx.remove_frontend(&fc->demux.dmx, &fc->mem_frontend);
 err_dmx_add_mem_frontend: