@@ -1508,10 +1508,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec)
if ((result = dvb_dmx_init(&dec->demux)) < 0) {
printk("%s: dvb_dmx_init failed: error %d\n", __func__,
result);
-
- dvb_unregister_adapter(&dec->adapter);
-
- return result;
+ goto unregister_adapter;
}
dec->dmxdev.filternum = 32;
@@ -1521,43 +1518,33 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec)
if ((result = dvb_dmxdev_init(&dec->dmxdev, &dec->adapter)) < 0) {
printk("%s: dvb_dmxdev_init failed: error %d\n",
__func__, result);
-
- dvb_dmx_release(&dec->demux);
- dvb_unregister_adapter(&dec->adapter);
-
- return result;
+ goto release_demux;
}
dec->frontend.source = DMX_FRONTEND_0;
- if ((result = dec->demux.dmx.add_frontend(&dec->demux.dmx,
- &dec->frontend)) < 0) {
- printk("%s: dvb_dmx_init failed: error %d\n", __func__,
- result);
-
- dvb_dmxdev_release(&dec->dmxdev);
- dvb_dmx_release(&dec->demux);
- dvb_unregister_adapter(&dec->adapter);
-
- return result;
- }
+ result = dec->demux.dmx.add_frontend(&dec->demux.dmx, &dec->frontend);
+ if (result < 0)
+ goto report_failure;
if ((result = dec->demux.dmx.connect_frontend(&dec->demux.dmx,
&dec->frontend)) < 0) {
- printk("%s: dvb_dmx_init failed: error %d\n", __func__,
- result);
-
dec->demux.dmx.remove_frontend(&dec->demux.dmx, &dec->frontend);
- dvb_dmxdev_release(&dec->dmxdev);
- dvb_dmx_release(&dec->demux);
- dvb_unregister_adapter(&dec->adapter);
-
- return result;
+ goto report_failure;
}
dvb_net_init(&dec->adapter, &dec->dvb_net, &dec->demux.dmx);
return 0;
+
+report_failure:
+ printk("%s: dvb_dmx_init failed: error %d\n", __func__, result);
+ dvb_dmxdev_release(&dec->dmxdev);
+release_demux:
+ dvb_dmx_release(&dec->demux);
+unregister_adapter:
+ dvb_unregister_adapter(&dec->adapter);
+ return result;
}
static void ttusb_dec_exit_dvb(struct ttusb_dec *dec)