From 01732ebaac701638aab5d7b63ea2ee14452afd33 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 31 Dec 2011 08:04:25 -0300 Subject: [media] flexcop: handle errors from dvb_net_init 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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/b2c2/flexcop.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'drivers/media/dvb/b2c2') diff --git a/drivers/media/dvb/b2c2/flexcop.c b/drivers/media/dvb/b2c2/flexcop.c index 2df1b0214dcd..4d3caca466fd 100644 --- a/drivers/media/dvb/b2c2/flexcop.c +++ b/drivers/media/dvb/b2c2/flexcop.c @@ -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: -- cgit v1.2.3 From efd279ec3e6129195580d40f88ea6c3f5af701b3 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Fri, 6 Jan 2012 12:57:56 -0300 Subject: [media] flexcop: CodingStyle fix: don't use "if ((ret = foo()) < 0)" Lift assignments from "if" conditionals for readability. No change in functionality intended. Suggested-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Nieder Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/b2c2/flexcop.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'drivers/media/dvb/b2c2') diff --git a/drivers/media/dvb/b2c2/flexcop.c b/drivers/media/dvb/b2c2/flexcop.c index 4d3caca466fd..b1e8c99f469b 100644 --- a/drivers/media/dvb/b2c2/flexcop.c +++ b/drivers/media/dvb/b2c2/flexcop.c @@ -86,7 +86,8 @@ static int flexcop_dvb_init(struct flexcop_device *fc) fc->demux.stop_feed = flexcop_dvb_stop_feed; fc->demux.write_to_decoder = NULL; - if ((ret = dvb_dmx_init(&fc->demux)) < 0) { + ret = dvb_dmx_init(&fc->demux); + if (ret < 0) { err("dvb_dmx failed: error %d", ret); goto err_dmx; } @@ -96,23 +97,27 @@ static int flexcop_dvb_init(struct flexcop_device *fc) fc->dmxdev.filternum = fc->demux.feednum; fc->dmxdev.demux = &fc->demux.dmx; fc->dmxdev.capabilities = 0; - if ((ret = dvb_dmxdev_init(&fc->dmxdev, &fc->dvb_adapter)) < 0) { + ret = dvb_dmxdev_init(&fc->dmxdev, &fc->dvb_adapter); + if (ret < 0) { err("dvb_dmxdev_init failed: error %d", ret); goto err_dmx_dev; } - if ((ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->hw_frontend)) < 0) { + ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->hw_frontend); + if (ret < 0) { err("adding hw_frontend to dmx failed: error %d", ret); goto err_dmx_add_hw_frontend; } fc->mem_frontend.source = DMX_MEMORY_FE; - if ((ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->mem_frontend)) < 0) { + ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->mem_frontend); + if (ret < 0) { err("adding mem_frontend to dmx failed: error %d", ret); goto err_dmx_add_mem_frontend; } - if ((ret = fc->demux.dmx.connect_frontend(&fc->demux.dmx, &fc->hw_frontend)) < 0) { + ret = fc->demux.dmx.connect_frontend(&fc->demux.dmx, &fc->hw_frontend); + if (ret < 0) { err("connect frontend failed: error %d", ret); goto err_connect_frontend; } @@ -260,7 +265,8 @@ int flexcop_device_initialize(struct flexcop_device *fc) flexcop_hw_filter_init(fc); flexcop_smc_ctrl(fc, 0); - if ((ret = flexcop_dvb_init(fc))) + ret = flexcop_dvb_init(fc); + if (ret) goto error; /* i2c has to be done before doing EEProm stuff - @@ -278,7 +284,8 @@ int flexcop_device_initialize(struct flexcop_device *fc) } else warn("reading of MAC address failed.\n"); - if ((ret = flexcop_frontend_init(fc))) + ret = flexcop_frontend_init(fc); + if (ret) goto error; flexcop_device_name(fc,"initialization of","complete"); -- cgit v1.2.3