[linux-dvb] [patch 2.6.12-rc4-dvb-cvs 11/14] dvb: codingstyle/cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 20, 2005 at 09:03:04PM +0200, Francois Romieu wrote:
> codingstyle/cleanup
> 
> - error code propagation and single point of exit for misc functions;

IMHO the "single point of exit" thing obfuscates the code. If all you
want is to return -EFOO, then "return -EFOO" is much more readable
than "ret = -EFOO; goto out;". Of course goto is useful for error
handling and semaphor cleanup, but please don't assume that we
want to abey a hard "single point of exit" rule.

> -static struct dvb_demux_feed * dvb_dmx_feed_alloc(struct dvb_demux *demux)
> +static struct dvb_demux_feed *dvb_dmx_feed_alloc(struct dvb_demux *demux)
>  {
>  	int i;
>  
> @@ -557,7 +557,7 @@ static struct dvb_demux_feed * dvb_dmx_f
>  			break;
>  
>  	if (i == demux->feednum)
> -		return NULL;
> +		return ERR_PTR(-EBUSY);

NACK on this change. dvb_dmx_feed_alloc() only has one error
return and that is NULL. No need for ERR_PTR().

> @@ -673,31 +673,35 @@ static int dmx_ts_feed_start_filtering(s
>  	struct dvb_demux *demux = feed->demux;
>  	int ret;
>  
> -	if (down_interruptible (&demux->mutex))
> -		return -ERESTARTSYS;
> +	ret = down_interruptible(&demux->mutex);
> +	if (ret < 0)
> +		goto out;

That would change the return value from -ERESTARTSYS to -EINTR.
I don't know if it is relevant, please check this.


Johannes



[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux