Re: drivers/iio/accel/adxl372.c:949:3: warning: converting the result of '<<' to a boolean always evaluates to true

From: Nathan Chancellor
Date: Thu Jan 14 2021 - 13:25:25 EST


On Fri, Jan 15, 2021 at 02:19:41AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 65f0d2414b7079556fbbcc070b3d1c9f9587606d
> commit: b0fc6783d4ae58f796fb183c40dbc7fa3199d51d iio: accel: adxl372: Add support for FIFO peak mode
> date: 4 months ago
> config: mips-randconfig-r026-20210114 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 68ff52ffead2ba25cca442778ab19286000daad7)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install mips cross compiling tool for clang build
> # apt-get install binutils-mips-linux-gnu
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b0fc6783d4ae58f796fb183c40dbc7fa3199d51d
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout b0fc6783d4ae58f796fb183c40dbc7fa3199d51d
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
> In file included from include/linux/interrupt.h:8:
> In file included from include/linux/cpumask.h:13:
> In file included from include/linux/atomic.h:7:
> arch/mips/include/asm/atomic.h:52:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
> arch/mips/include/asm/atomic.h:45:9: note: expanded from macro 'ATOMIC_OPS'
> return xchg(&v->counter, n); \
> ^
> arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
> if (!__SYNC_loongson3_war) \
> ^
> arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
> # define __SYNC_loongson3_war (1 << 31)
> ^

Sorry for the noise, I have sent a patch to fix this:

https://lore.kernel.org/lkml/20210114173416.738455-1-natechancellor@xxxxxxxxx/

Cheers,
Nathan