Re: [PATCH] Staging/comedi: Fixes static analysis warning raised by sparse

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

 



On Mon, Jun 09, 2014 at 09:24:35PM -0400, Marcos A. Di Pietro wrote:
> Fixes warning static analysis warning raised by sparse in drivers/staging/comedi/drivers/ni_stc.h
> 
> warning: shift too big (4294967295) for type int

This warning seems wrong.  I don't even understand how it thinks the
shift is too big. The patch doesn't make sense and it introduces a bug.

> Signed-off-by: Marcos A. Di Pietro <marcosadp@xxxxxxxxx>
> ---
>  drivers/staging/comedi/drivers/ni_stc.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h
> index f0630b78..8ef420c 100644
> --- a/drivers/staging/comedi/drivers/ni_stc.h
> +++ b/drivers/staging/comedi/drivers/ni_stc.h
> @@ -716,8 +716,12 @@ enum AI_AO_Select_Bits {
>  #define G0_G1_Select			0x0b
>  static inline unsigned ni_stc_dma_channel_select_bitfield(unsigned channel)
>  {
> -	if (channel < 4)
> -		return 1 << channel;
> +	if (channel == 1)
> +		return 1 << 0x1;
> +	if (channel == 2)
> +		return 1 << 0x2;
> +	if (channel == 3 || channel == 4)
> +		return 1 << 0x3;
>  	if (channel == 4)
>  		return 0x3;

channel == 4 is supposed to be handled here.

regards,
dan carpenter

>  	if (channel == 5)
> -- 
> 1.8.3.2
_______________________________________________
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