llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [clk:clk-sunplus 1/1] drivers/clk/clk-sp7021.c:316:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigne...
@ 2023-03-22 11:17 kernel test robot
  2023-03-22 17:39 ` Stephen Boyd
  0 siblings, 1 reply; 7+ messages in thread
From: kernel test robot @ 2023-03-22 11:17 UTC (permalink / raw)
  To: Qin Jian; +Cc: llvm, oe-kbuild-all, linux-clk, linux-arm-kernel, Stephen Boyd

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-sunplus
head:   d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
commit: d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2 [1/1] clk: Add Sunplus SP7021 clock driver
config: mips-randconfig-r012-20230322 (https://download.01.org/0day-ci/archive/20230322/202303221947.pXP2v4xJ-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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-mipsel-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/commit/?id=d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
        git remote add clk https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
        git fetch --no-tags clk clk-sunplus
        git checkout d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/clk/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303221947.pXP2v4xJ-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/clk/clk-sp7021.c:316:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (_m)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
           r0 |= HWM_FIELD_PREP(MASK_SEL_FRA, clk->p[SEL_FRA]);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk-sp7021.c:45:15: note: expanded from macro 'HWM_FIELD_PREP'
           (_m << 16) | FIELD_PREP(_m, value);     \
                        ^~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP'
                   __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: ");    \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) >     \
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:397:22: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:385:23: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:377:9: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                         ^~~~~~~~~
   drivers/clk/clk-sp7021.c:317:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (_m)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
           r0 |= HWM_FIELD_PREP(MASK_SDM_MOD, clk->p[SDM_MOD]);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk-sp7021.c:45:15: note: expanded from macro 'HWM_FIELD_PREP'
           (_m << 16) | FIELD_PREP(_m, value);     \
                        ^~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP'
                   __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: ");    \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) >     \
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:397:22: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:385:23: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:377:9: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                         ^~~~~~~~~
   drivers/clk/clk-sp7021.c:318:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (_m)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
           r0 |= HWM_FIELD_PREP(MASK_PH_SEL, clk->p[PH_SEL]);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk-sp7021.c:45:15: note: expanded from macro 'HWM_FIELD_PREP'
           (_m << 16) | FIELD_PREP(_m, value);     \
                        ^~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP'
                   __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: ");    \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) >     \
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:397:22: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:385:23: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:377:9: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                         ^~~~~~~~~
   drivers/clk/clk-sp7021.c:319:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (_m)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
           r0 |= HWM_FIELD_PREP(MASK_NFRA, clk->p[NFRA]);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk-sp7021.c:45:15: note: expanded from macro 'HWM_FIELD_PREP'
           (_m << 16) | FIELD_PREP(_m, value);     \
                        ^~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP'
                   __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: ");    \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) >     \
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:397:22: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:385:23: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:377:9: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                         ^~~~~~~~~
   drivers/clk/clk-sp7021.c:321:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (_m)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
           r1  = HWM_FIELD_PREP(MASK_DIVR, clk->p[DIVR]);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk-sp7021.c:45:15: note: expanded from macro 'HWM_FIELD_PREP'
           (_m << 16) | FIELD_PREP(_m, value);     \
                        ^~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:114:3: note: expanded from macro 'FIELD_PREP'
                   __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: ");    \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitfield.h:71:53: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) >     \
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)


vim +316 drivers/clk/clk-sp7021.c

   309	
   310	static int plltv_set_rate(struct sp_pll *clk)
   311	{
   312		unsigned long flags;
   313		u32 r0, r1, r2;
   314	
   315		r0  = BIT(clk->bp_bit + 16);
 > 316		r0 |= HWM_FIELD_PREP(MASK_SEL_FRA, clk->p[SEL_FRA]);
   317		r0 |= HWM_FIELD_PREP(MASK_SDM_MOD, clk->p[SDM_MOD]);
   318		r0 |= HWM_FIELD_PREP(MASK_PH_SEL, clk->p[PH_SEL]);
   319		r0 |= HWM_FIELD_PREP(MASK_NFRA, clk->p[NFRA]);
   320	
   321		r1  = HWM_FIELD_PREP(MASK_DIVR, clk->p[DIVR]);
   322	
   323		r2  = HWM_FIELD_PREP(MASK_DIVN, clk->p[DIVN] - 1);
   324		r2 |= HWM_FIELD_PREP(MASK_DIVM, clk->p[DIVM] - 1);
   325	
   326		spin_lock_irqsave(&clk->lock, flags);
   327		writel(r0, clk->reg);
   328		writel(r1, clk->reg + 4);
   329		writel(r2, clk->reg + 8);
   330		spin_unlock_irqrestore(&clk->lock, flags);
   331	
   332		return 0;
   333	}
   334	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [clk:clk-sunplus 1/1] drivers/clk/clk-sp7021.c:316:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigne...
  2023-03-22 11:17 [clk:clk-sunplus 1/1] drivers/clk/clk-sp7021.c:316:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigne kernel test robot
@ 2023-03-22 17:39 ` Stephen Boyd
  2023-03-22 19:59   ` Nathan Chancellor
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2023-03-22 17:39 UTC (permalink / raw)
  To: Qin Jian, kernel test robot
  Cc: llvm, oe-kbuild-all, linux-clk, linux-arm-kernel

Quoting kernel test robot (2023-03-22 04:17:48)
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-sunplus
> head:   d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
> commit: d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2 [1/1] clk: Add Sunplus SP7021 clock driver
> config: mips-randconfig-r012-20230322 (https://download.01.org/0day-ci/archive/20230322/202303221947.pXP2v4xJ-lkp@intel.com/config)
> compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
> 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-mipsel-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/commit/?id=d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
>         git remote add clk https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
>         git fetch --no-tags clk clk-sunplus
>         git checkout d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips olddefconfig
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/clk/
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Link: https://lore.kernel.org/oe-kbuild-all/202303221947.pXP2v4xJ-lkp@intel.com/
> 

Does this fix it?

---8<---
diff --git a/drivers/clk/clk-sp7021.c b/drivers/clk/clk-sp7021.c
index 8fec14120105..caabbf5e2197 100644
--- a/drivers/clk/clk-sp7021.c
+++ b/drivers/clk/clk-sp7021.c
@@ -30,9 +30,9 @@ enum {
 	P_MAX
 };
 
-#define MASK_SEL_FRA	GENMASK(1, 1)
-#define MASK_SDM_MOD	GENMASK(2, 2)
-#define MASK_PH_SEL	GENMASK(4, 4)
+#define MASK_SEL_FRA	BITMASK(1)
+#define MASK_SDM_MOD	BITMASK(2)
+#define MASK_PH_SEL	BITMASK(4)
 #define MASK_NFRA	GENMASK(12, 6)
 #define MASK_DIVR	GENMASK(8, 7)
 #define MASK_DIVN	GENMASK(7, 0)

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [clk:clk-sunplus 1/1] drivers/clk/clk-sp7021.c:316:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigne...
  2023-03-22 17:39 ` Stephen Boyd
@ 2023-03-22 19:59   ` Nathan Chancellor
  2023-03-22 23:48     ` Stephen Boyd
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2023-03-22 19:59 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Qin Jian, kernel test robot, llvm, oe-kbuild-all, linux-clk,
	linux-arm-kernel

On Wed, Mar 22, 2023 at 10:39:06AM -0700, Stephen Boyd wrote:
> Quoting kernel test robot (2023-03-22 04:17:48)
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-sunplus
> > head:   d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
> > commit: d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2 [1/1] clk: Add Sunplus SP7021 clock driver
> > config: mips-randconfig-r012-20230322 (https://download.01.org/0day-ci/archive/20230322/202303221947.pXP2v4xJ-lkp@intel.com/config)
> > compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
> > 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-mipsel-linux-gnu
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/commit/?id=d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
> >         git remote add clk https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
> >         git fetch --no-tags clk clk-sunplus
> >         git checkout d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
> >         # save the config file
> >         mkdir build_dir && cp config build_dir/.config
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips olddefconfig
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/clk/
> > 
> > If you fix the issue, kindly add following tag where applicable
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Link: https://lore.kernel.org/oe-kbuild-all/202303221947.pXP2v4xJ-lkp@intel.com/
> > 
> 
> Does this fix it?
> 
> ---8<---
> diff --git a/drivers/clk/clk-sp7021.c b/drivers/clk/clk-sp7021.c
> index 8fec14120105..caabbf5e2197 100644
> --- a/drivers/clk/clk-sp7021.c
> +++ b/drivers/clk/clk-sp7021.c
> @@ -30,9 +30,9 @@ enum {
>  	P_MAX
>  };
>  
> -#define MASK_SEL_FRA	GENMASK(1, 1)
> -#define MASK_SDM_MOD	GENMASK(2, 2)
> -#define MASK_PH_SEL	GENMASK(4, 4)
> +#define MASK_SEL_FRA	BITMASK(1)
> +#define MASK_SDM_MOD	BITMASK(2)
> +#define MASK_PH_SEL	BITMASK(4)
>  #define MASK_NFRA	GENMASK(12, 6)
>  #define MASK_DIVR	GENMASK(8, 7)
>  #define MASK_DIVN	GENMASK(7, 0)
> 

No (BITMASK did not exist but BIT_MASK does). It looks like clang is
complaining that mask is an unsigned int and it is being compared
against ~0ull, which will always be false. This makes the warning go
away for me, which is similar to commit cfd6fb45cfaf ("crypto: ccree -
avoid out-of-range warnings from clang"), but I am not sure if that is
correct or not.

diff --git a/drivers/clk/clk-sp7021.c b/drivers/clk/clk-sp7021.c
index 8fec14120105..11d22043ddd7 100644
--- a/drivers/clk/clk-sp7021.c
+++ b/drivers/clk/clk-sp7021.c
@@ -41,7 +41,7 @@ enum {
 /* HIWORD_MASK FIELD_PREP */
 #define HWM_FIELD_PREP(mask, value)		\
 ({						\
-	u32 _m = mask;				\
+	u64 _m = mask;				\
 	(_m << 16) | FIELD_PREP(_m, value);	\
 })
 

For the record, this only happens under W=1 but I think we would like to
eventually enable this warning so it would be good to avoid introducing
new instances.

Cheers,
Nathan

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [clk:clk-sunplus 1/1] drivers/clk/clk-sp7021.c:316:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigne...
  2023-03-22 19:59   ` Nathan Chancellor
@ 2023-03-22 23:48     ` Stephen Boyd
  2023-03-24 14:50       ` Nathan Chancellor
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2023-03-22 23:48 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Qin Jian, kernel test robot, llvm, oe-kbuild-all, linux-clk,
	linux-arm-kernel

Quoting Nathan Chancellor (2023-03-22 12:59:33)
> On Wed, Mar 22, 2023 at 10:39:06AM -0700, Stephen Boyd wrote:
> > Quoting kernel test robot (2023-03-22 04:17:48)
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-sunplus
> > > head:   d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
> > > commit: d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2 [1/1] clk: Add Sunplus SP7021 clock driver
> > > config: mips-randconfig-r012-20230322 (https://download.01.org/0day-ci/archive/20230322/202303221947.pXP2v4xJ-lkp@intel.com/config)
> > > compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
> > > 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-mipsel-linux-gnu
> > >         # https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/commit/?id=d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
> > >         git remote add clk https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
> > >         git fetch --no-tags clk clk-sunplus
> > >         git checkout d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
> > >         # save the config file
> > >         mkdir build_dir && cp config build_dir/.config
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips olddefconfig
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/clk/
> > > 
> > > If you fix the issue, kindly add following tag where applicable
> > > | Reported-by: kernel test robot <lkp@intel.com>
> > > | Link: https://lore.kernel.org/oe-kbuild-all/202303221947.pXP2v4xJ-lkp@intel.com/
> > > 
> > 
> > Does this fix it?
> > 
> > ---8<---
> > diff --git a/drivers/clk/clk-sp7021.c b/drivers/clk/clk-sp7021.c
> > index 8fec14120105..caabbf5e2197 100644
> > --- a/drivers/clk/clk-sp7021.c
> > +++ b/drivers/clk/clk-sp7021.c
> > @@ -30,9 +30,9 @@ enum {
> >       P_MAX
> >  };
> >  
> > -#define MASK_SEL_FRA GENMASK(1, 1)
> > -#define MASK_SDM_MOD GENMASK(2, 2)
> > -#define MASK_PH_SEL  GENMASK(4, 4)
> > +#define MASK_SEL_FRA BITMASK(1)
> > +#define MASK_SDM_MOD BITMASK(2)
> > +#define MASK_PH_SEL  BITMASK(4)
> >  #define MASK_NFRA    GENMASK(12, 6)
> >  #define MASK_DIVR    GENMASK(8, 7)
> >  #define MASK_DIVN    GENMASK(7, 0)
> > 
> 
> No (BITMASK did not exist but BIT_MASK does).

Heh ok.

> It looks like clang is
> complaining that mask is an unsigned int and it is being compared
> against ~0ull, which will always be false. This makes the warning go
> away for me, which is similar to commit cfd6fb45cfaf ("crypto: ccree -
> avoid out-of-range warnings from clang"), but I am not sure if that is
> correct or not.

Cool thanks. Can you send it as a proper patch?

> 
> diff --git a/drivers/clk/clk-sp7021.c b/drivers/clk/clk-sp7021.c
> index 8fec14120105..11d22043ddd7 100644
> --- a/drivers/clk/clk-sp7021.c
> +++ b/drivers/clk/clk-sp7021.c
> @@ -41,7 +41,7 @@ enum {
>  /* HIWORD_MASK FIELD_PREP */
>  #define HWM_FIELD_PREP(mask, value)            \
>  ({                                             \
> -       u32 _m = mask;                          \
> +       u64 _m = mask;                          \
>         (_m << 16) | FIELD_PREP(_m, value);     \
>  })
>  
> 
> For the record, this only happens under W=1 but I think we would like to
> eventually enable this warning so it would be good to avoid introducing
> new instances.

It makes sense to me because FIELD_PREP typically takes a GENMASK input,
which is an unsigned long long shifted around. 

I think I'm building with W=1, but I'm not building with clang. I'll
have to go fetch another compiler and put it into circulation.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [clk:clk-sunplus 1/1] drivers/clk/clk-sp7021.c:316:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigne...
  2023-03-22 23:48     ` Stephen Boyd
@ 2023-03-24 14:50       ` Nathan Chancellor
  2023-04-29  1:13         ` Stephen Boyd
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2023-03-24 14:50 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Qin Jian, kernel test robot, llvm, oe-kbuild-all, linux-clk,
	linux-arm-kernel

On Wed, Mar 22, 2023 at 04:48:43PM -0700, Stephen Boyd wrote:
> Quoting Nathan Chancellor (2023-03-22 12:59:33)
> > On Wed, Mar 22, 2023 at 10:39:06AM -0700, Stephen Boyd wrote:
> > > Quoting kernel test robot (2023-03-22 04:17:48)
> > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-sunplus
> > > > head:   d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
> > > > commit: d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2 [1/1] clk: Add Sunplus SP7021 clock driver
> > > > config: mips-randconfig-r012-20230322 (https://download.01.org/0day-ci/archive/20230322/202303221947.pXP2v4xJ-lkp@intel.com/config)
> > > > compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
> > > > 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-mipsel-linux-gnu
> > > >         # https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/commit/?id=d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
> > > >         git remote add clk https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
> > > >         git fetch --no-tags clk clk-sunplus
> > > >         git checkout d54c1fd4a51e8fbc7f9da86b0cd338a4f7cd2bb2
> > > >         # save the config file
> > > >         mkdir build_dir && cp config build_dir/.config
> > > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips olddefconfig
> > > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/clk/
> > > > 
> > > > If you fix the issue, kindly add following tag where applicable
> > > > | Reported-by: kernel test robot <lkp@intel.com>
> > > > | Link: https://lore.kernel.org/oe-kbuild-all/202303221947.pXP2v4xJ-lkp@intel.com/
> > > > 
> > > 
> > > Does this fix it?
> > > 
> > > ---8<---
> > > diff --git a/drivers/clk/clk-sp7021.c b/drivers/clk/clk-sp7021.c
> > > index 8fec14120105..caabbf5e2197 100644
> > > --- a/drivers/clk/clk-sp7021.c
> > > +++ b/drivers/clk/clk-sp7021.c
> > > @@ -30,9 +30,9 @@ enum {
> > >       P_MAX
> > >  };
> > >  
> > > -#define MASK_SEL_FRA GENMASK(1, 1)
> > > -#define MASK_SDM_MOD GENMASK(2, 2)
> > > -#define MASK_PH_SEL  GENMASK(4, 4)
> > > +#define MASK_SEL_FRA BITMASK(1)
> > > +#define MASK_SDM_MOD BITMASK(2)
> > > +#define MASK_PH_SEL  BITMASK(4)
> > >  #define MASK_NFRA    GENMASK(12, 6)
> > >  #define MASK_DIVR    GENMASK(8, 7)
> > >  #define MASK_DIVN    GENMASK(7, 0)
> > > 
> > 
> > No (BITMASK did not exist but BIT_MASK does).
> 
> Heh ok.
> 
> > It looks like clang is
> > complaining that mask is an unsigned int and it is being compared
> > against ~0ull, which will always be false. This makes the warning go
> > away for me, which is similar to commit cfd6fb45cfaf ("crypto: ccree -
> > avoid out-of-range warnings from clang"), but I am not sure if that is
> > correct or not.
> 
> Cool thanks. Can you send it as a proper patch?

Sure thing, I will do so when I am back online next week.

> > diff --git a/drivers/clk/clk-sp7021.c b/drivers/clk/clk-sp7021.c
> > index 8fec14120105..11d22043ddd7 100644
> > --- a/drivers/clk/clk-sp7021.c
> > +++ b/drivers/clk/clk-sp7021.c
> > @@ -41,7 +41,7 @@ enum {
> >  /* HIWORD_MASK FIELD_PREP */
> >  #define HWM_FIELD_PREP(mask, value)            \
> >  ({                                             \
> > -       u32 _m = mask;                          \
> > +       u64 _m = mask;                          \
> >         (_m << 16) | FIELD_PREP(_m, value);     \
> >  })
> >  
> > 
> > For the record, this only happens under W=1 but I think we would like to
> > eventually enable this warning so it would be good to avoid introducing
> > new instances.
> 
> It makes sense to me because FIELD_PREP typically takes a GENMASK input,
> which is an unsigned long long shifted around. 
> 
> I think I'm building with W=1, but I'm not building with clang. I'll
> have to go fetch another compiler and put it into circulation.

If you have not seen it already, I provide prebuilt up to date versions
of clang on kernel.org, which I hope eases the friction of testing with
two compilers:

https://lore.kernel.org/20230319235619.GA18547@dev-arch.thelio-3990X/

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [clk:clk-sunplus 1/1] drivers/clk/clk-sp7021.c:316:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigne...
  2023-03-24 14:50       ` Nathan Chancellor
@ 2023-04-29  1:13         ` Stephen Boyd
  2023-05-01 16:28           ` Nathan Chancellor
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2023-04-29  1:13 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Qin Jian, kernel test robot, llvm, oe-kbuild-all, linux-clk,
	linux-arm-kernel

Quoting Nathan Chancellor (2023-03-24 07:50:56)
> On Wed, Mar 22, 2023 at 04:48:43PM -0700, Stephen Boyd wrote:
> > Quoting Nathan Chancellor (2023-03-22 12:59:33)
> > 
> > > It looks like clang is
> > > complaining that mask is an unsigned int and it is being compared
> > > against ~0ull, which will always be false. This makes the warning go
> > > away for me, which is similar to commit cfd6fb45cfaf ("crypto: ccree -
> > > avoid out-of-range warnings from clang"), but I am not sure if that is
> > > correct or not.
> > 
> > Cool thanks. Can you send it as a proper patch?
> 
> Sure thing, I will do so when I am back online next week.
> 

Did you send the patch?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [clk:clk-sunplus 1/1] drivers/clk/clk-sp7021.c:316:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigne...
  2023-04-29  1:13         ` Stephen Boyd
@ 2023-05-01 16:28           ` Nathan Chancellor
  0 siblings, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2023-05-01 16:28 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Qin Jian, kernel test robot, llvm, oe-kbuild-all, linux-clk,
	linux-arm-kernel

On Fri, Apr 28, 2023 at 06:13:34PM -0700, Stephen Boyd wrote:
> Quoting Nathan Chancellor (2023-03-24 07:50:56)
> > On Wed, Mar 22, 2023 at 04:48:43PM -0700, Stephen Boyd wrote:
> > > Quoting Nathan Chancellor (2023-03-22 12:59:33)
> > > 
> > > > It looks like clang is
> > > > complaining that mask is an unsigned int and it is being compared
> > > > against ~0ull, which will always be false. This makes the warning go
> > > > away for me, which is similar to commit cfd6fb45cfaf ("crypto: ccree -
> > > > avoid out-of-range warnings from clang"), but I am not sure if that is
> > > > correct or not.
> > > 
> > > Cool thanks. Can you send it as a proper patch?
> > 
> > Sure thing, I will do so when I am back online next week.
> > 
> 
> Did you send the patch?

Ugh, I am so sorry, I never added that to my TOOD list so I never
rememebered after I got back :/ I will make sure to send the patch
today.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-05-01 16:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 11:17 [clk:clk-sunplus 1/1] drivers/clk/clk-sp7021.c:316:8: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((_m), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigne kernel test robot
2023-03-22 17:39 ` Stephen Boyd
2023-03-22 19:59   ` Nathan Chancellor
2023-03-22 23:48     ` Stephen Boyd
2023-03-24 14:50       ` Nathan Chancellor
2023-04-29  1:13         ` Stephen Boyd
2023-05-01 16:28           ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).