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

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

 



On Tue, Mar 07, 2017 at 05:33:08PM +1100, Tobin C. Harding wrote:
> @@ -1375,7 +1378,7 @@ static int dgnc_tty_chars_in_buffer(struct tty_struct *tty)
>  	ushort thead;
>  	ushort ttail;
>  	uint tmask;
> -	uint chars = 0;
> +	uint chars;
>  	unsigned long flags;
>  
>  	if (!tty)
> @@ -1397,16 +1400,14 @@ static int dgnc_tty_chars_in_buffer(struct tty_struct *tty)
>  
>  	spin_unlock_irqrestore(&ch->ch_lock, flags);
>  
> -	if (ttail == thead) {
> +	if (ttail == thead)
>  		chars = 0;
> -	} else {
> -		if (thead >= ttail)
> -			chars = thead - ttail;
> -		else
> -			chars = thead - ttail + WQUEUESIZE;
> -	}
> +	else if (thead > ttail)
> +		chars = thead - ttail;
> +	else
> +		chars = thead - ttail + WQUEUESIZE;
>  
> -	return chars;
> +	return (int)chars;

This cast means something suspicious is going on.  Is there really
something suspicous going on?  Can we fix the types?  Can we just remove
the cast?

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