RE: [PATCH] staging/comedi/dt282x: avoid integer overflow warning

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

 



On Monday, March 14, 2016 3:48 PM, Arnd Bergmann wrote:
> gcc-6 warns about passing negative signed integer into swab16()
> in the dt282x driver:

<snip>

> The warning makes sense, though the code is correct as far as I
> can tell.
>
> This disambiguates the operation by making the constant expressions
> we pass here explicitly 'unsigned', which helps to avoid the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
>  drivers/staging/comedi/drivers/dt282x.c | 62 ++++++++++++++++-----------------
>  1 file changed, 31 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c
> index 40bf00984fa5..d4d45c759c62 100644
> --- a/drivers/staging/comedi/drivers/dt282x.c
> +++ b/drivers/staging/comedi/drivers/dt282x.c
> @@ -69,48 +69,48 @@
>   * Register map
>   */
>  #define DT2821_ADCSR_REG		0x00
> -#define DT2821_ADCSR_ADERR		(1 << 15)
> -#define DT2821_ADCSR_ADCLK		(1 << 9)
> -#define DT2821_ADCSR_MUXBUSY		(1 << 8)
> -#define DT2821_ADCSR_ADDONE		(1 << 7)
> -#define DT2821_ADCSR_IADDONE		(1 << 6)
> +#define DT2821_ADCSR_ADERR		(1u << 15)

Changing all of these to use the BIT() macro should also avoid the warning.

Hartley
_______________________________________________
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