[media] firedtv: handle errors from dvb_net_init
authorJonathan Nieder <jrnieder@gmail.com>
Sat, 31 Dec 2011 11:19:56 +0000 (08:19 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 6 Jan 2012 14:51:26 +0000 (12:51 -0200)
It is not common for dvb_net_init to fail, but after the patch
"dvb_net_init: return -errno on error" it can fail due to running out
of memory.  Handle this.

From an audit of dvb_net_init callers.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/firewire/firedtv-dvb.c

index fd8bbbfa5c598e39896aaae1ea5e001002bdb6d5..eb7496eab130cfb54d5daa39717e61ed3594a695 100644 (file)
@@ -203,7 +203,9 @@ int fdtv_dvb_register(struct firedtv *fdtv, const char *name)
        if (err)
                goto fail_rem_frontend;
 
-       dvb_net_init(&fdtv->adapter, &fdtv->dvbnet, &fdtv->demux.dmx);
+       err = dvb_net_init(&fdtv->adapter, &fdtv->dvbnet, &fdtv->demux.dmx);
+       if (err)
+               goto fail_disconnect_frontend;
 
        fdtv_frontend_init(fdtv, name);
        err = dvb_register_frontend(&fdtv->adapter, &fdtv->fe);
@@ -218,6 +220,7 @@ int fdtv_dvb_register(struct firedtv *fdtv, const char *name)
 
 fail_net_release:
        dvb_net_release(&fdtv->dvbnet);
+fail_disconnect_frontend:
        fdtv->demux.dmx.close(&fdtv->demux.dmx);
 fail_rem_frontend:
        fdtv->demux.dmx.remove_frontend(&fdtv->demux.dmx, &fdtv->frontend);