[PATCH 3/4] staging: dgnc: audit goto's in dgnc_tty

Dan Carpenter dan.carpenter at oracle.com
Tue Mar 7 17:08:44 UTC 2017


On Tue, Mar 07, 2017 at 05:33:08PM +1100, Tobin C. Harding wrote:
> @@ -1668,20 +1669,20 @@ static int dgnc_tty_tiocmget(struct tty_struct *tty)
>  {
>  	struct channel_t *ch;
>  	struct un_t *un;
> -	int result = -EIO;
> +	int rc = -EIO;
>  	unsigned char mstat = 0;
>  	unsigned long flags;
>  
>  	if (!tty || tty->magic != TTY_MAGIC)
> -		return result;
> +		return rc;
>  

It's better to just do "return -EIO;"  That way all the information is
on one line, and you don't need to scroll back to find out what it's
returning.

> @@ -1987,20 +1990,21 @@ static int dgnc_tty_digigeta(struct tty_struct *tty,
>  	struct un_t *un;
>  	struct digi_t tmp;
>  	unsigned long flags;
> +	int rc = -EFAULT;
>  
>  	if (!retinfo)
> -		return -EFAULT;
> +		return rc;

The original is better here.

regards,
dan carpenter


More information about the devel mailing list