Re: [PATCH 1/2] staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c

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

 



On Mon, Oct 28, 2013 at 01:19:29PM -0700, Lisa Nguyen wrote:
> --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
> +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> @@ -346,7 +346,10 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe)
>  	}
>  	mutex_unlock(&mdev->graph_mutex);
>  
> -	return (ret == 0) ? ret : -ETIMEDOUT ;
> +	if (ret == 0)
> +		return ret;
> +	else
> +		return -ETIMEDOUT;
>  }

Since everyone has an opinion on this return format my prefered is:

	if (ret)
		return -ETIMEDOUT;
	return 0;

I like a clear "return 0;" instead of a "return ret;" where ret is
always zero.

I also like to keep my error path and my success path as separate as
possible.  Handle the errors right away and move them out of the success
path.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux