Re: [PATCH 9/9] [media] firedtv: handle errors from dvb_net_init

2012-01-06 Thread Mauro Carvalho Chehab
On 31-12-2011 10:19, Jonathan Nieder wrote:
 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 jrnie...@gmail.com
 ---
 That's the end of the series, though it would have been nice to
 also check the error handling in
 
  dvb/mantis/mantis_dvb.c
  dvb/ngene/ngene-core.c (which looks a little strange)
  dvb/pluto2/pluto2.c
  dvb/pt1/pt1.c
  dvb/ttpci/av7110.c 
  dvb/ttpci/budget-core.c
  dvb/ttusb-dec/ttusb_dec.c
  video/au0828/au0828-dvb.c
  video/cx18/cx18-dvb.c
  video/cx231xx/cx231xx-dvb.c
  video/em28xx/em28xx-dvb.c
  video/pvrusb2/pvrusb2-dvb.c
  video/saa7164/saa7164-dvb.c

It would be good if you could take a look on them and send us patches
for them if needed ;)

 
 Hopefully this gives the idea, anyway.  Patch 2 is the important one,
 and the patches after that are just toys to show off patch 1.
 
 Warning: the patches are _completely_ _untested_.  Test results
 (perhaps from provoking artificial failures in dvb_net_init), just
 like other comments, would be very welcome.
 
 'night,
 Jonathan
 
  drivers/media/dvb/firewire/firedtv-dvb.c |5 -
  1 files changed, 4 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/media/dvb/firewire/firedtv-dvb.c 
 b/drivers/media/dvb/firewire/firedtv-dvb.c
 index fd8bbbfa5c59..eb7496eab130 100644
 --- a/drivers/media/dvb/firewire/firedtv-dvb.c
 +++ b/drivers/media/dvb/firewire/firedtv-dvb.c
 @@ -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);

--
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


Re: [PATCH 9/9] [media] firedtv: handle errors from dvb_net_init

2011-12-31 Thread Stefan Richter
On Dec 31 Jonathan Nieder wrote:
 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 jrnie...@gmail.com

Reviewed-by: Stefan Richter stef...@s5r6.in-berlin.de

[...]
 --- a/drivers/media/dvb/firewire/firedtv-dvb.c
 +++ b/drivers/media/dvb/firewire/firedtv-dvb.c
 @@ -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);

-- 
Stefan Richter
-=-==-== ==-- =
http://arcgraph.de/sr/
--
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