drivers/clk/clk-stm32f4.c:871:6: note: in expansion of macro 'GENMASK_ULL'

From: kbuild test robot
Date: Tue May 19 2020 - 08:18:46 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 642b151f45dd54809ea00ecd3976a56c1ec9b53d
commit: 295bcca84916cb5079140a89fccb472bb8d1f6e2 linux/bits.h: add compile time sanity check of GENMASK inputs
date: 6 weeks ago
config: arm-randconfig-r016-20200519 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 295bcca84916cb5079140a89fccb472bb8d1f6e2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/of.h:15,
from include/linux/clk-provider.h:9,
from drivers/clk/clk-stm32f4.c:8:
drivers/clk/clk-stm32f4.c: In function 'stm32f4_rcc_lookup_clk_idx':
include/linux/bits.h:26:28: warning: comparison is always false due to limited range of data type [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
45 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
| ^~~~~~~~~~~~~~~~~~~
>> drivers/clk/clk-stm32f4.c:871:6: note: in expansion of macro 'GENMASK_ULL'
871 | GENMASK_ULL(secondary % BITS_PER_LONG_LONG, 0);
| ^~~~~~~~~~~
include/linux/bits.h:26:40: warning: comparison is always false due to limited range of data type [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
45 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
| ^~~~~~~~~~~~~~~~~~~
>> drivers/clk/clk-stm32f4.c:871:6: note: in expansion of macro 'GENMASK_ULL'
871 | GENMASK_ULL(secondary % BITS_PER_LONG_LONG, 0);
| ^~~~~~~~~~~
--
In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/kernel.h:12,
from include/linux/mfd/syscon/atmel-smc.h:14,
from drivers/mfd/atmel-smc.c:11:
drivers/mfd/atmel-smc.c: In function 'atmel_smc_cs_encode_ncycles':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
>> drivers/mfd/atmel-smc.c:49:25: note: in expansion of macro 'GENMASK'
49 | unsigned int lsbmask = GENMASK(msbpos - 1, 0);
| ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
>> drivers/mfd/atmel-smc.c:49:25: note: in expansion of macro 'GENMASK'
49 | unsigned int lsbmask = GENMASK(msbpos - 1, 0);
| ^~~~~~~
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/mfd/atmel-smc.c:50:25: note: in expansion of macro 'GENMASK'
50 | unsigned int msbmask = GENMASK(msbwidth - 1, 0);
| ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/mfd/atmel-smc.c:50:25: note: in expansion of macro 'GENMASK'
50 | unsigned int msbmask = GENMASK(msbwidth - 1, 0);
| ^~~~~~~
--
In file included from include/linux/byteorder/little_endian.h:5,
from arch/arm/include/uapi/asm/byteorder.h:22,
from include/asm-generic/bitops/le.h:6,
from arch/arm/include/asm/bitops.h:268,
from include/linux/bitops.h:29,
from include/linux/kernel.h:12,
from include/linux/clk.h:13,
from drivers/crypto/inside-secure/safexcel.c:8:
drivers/crypto/inside-secure/safexcel.c: In function 'safexcel_hw_init':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/uapi/linux/byteorder/little_endian.h:33:51: note: in definition of macro '__cpu_to_le32'
33 | #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
| ^
>> arch/arm/include/asm/io.h:307:36: note: in expansion of macro 'writel_relaxed'
307 | #define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
| ^~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:648:4: note: in expansion of macro 'writel'
648 | writel(EIP197_HIA_RA_PE_CTRL_EN |
| ^~~~~~
include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
25 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:649:11: note: in expansion of macro 'GENMASK'
649 | GENMASK(priv->config.rings - 1, 0),
| ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/uapi/linux/byteorder/little_endian.h:33:51: note: in definition of macro '__cpu_to_le32'
33 | #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
| ^
>> arch/arm/include/asm/io.h:307:36: note: in expansion of macro 'writel_relaxed'
307 | #define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
| ^~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:648:4: note: in expansion of macro 'writel'
648 | writel(EIP197_HIA_RA_PE_CTRL_EN |
| ^~~~~~
include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
25 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:649:11: note: in expansion of macro 'GENMASK'
649 | GENMASK(priv->config.rings - 1, 0),
| ^~~~~~~
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/uapi/linux/byteorder/little_endian.h:33:51: note: in definition of macro '__cpu_to_le32'
33 | #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
| ^
>> arch/arm/include/asm/io.h:307:36: note: in expansion of macro 'writel_relaxed'
307 | #define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
| ^~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:757:3: note: in expansion of macro 'writel'
757 | writel(EIP197_DxE_THR_CTRL_EN | GENMASK(priv->config.rings - 1, 0),
| ^~~~~~
include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
25 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:757:35: note: in expansion of macro 'GENMASK'
757 | writel(EIP197_DxE_THR_CTRL_EN | GENMASK(priv->config.rings - 1, 0),
| ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/uapi/linux/byteorder/little_endian.h:33:51: note: in definition of macro '__cpu_to_le32'
33 | #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
| ^
>> arch/arm/include/asm/io.h:307:36: note: in expansion of macro 'writel_relaxed'
307 | #define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
| ^~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:757:3: note: in expansion of macro 'writel'
757 | writel(EIP197_DxE_THR_CTRL_EN | GENMASK(priv->config.rings - 1, 0),
| ^~~~~~
include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
25 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:757:35: note: in expansion of macro 'GENMASK'
757 | writel(EIP197_DxE_THR_CTRL_EN | GENMASK(priv->config.rings - 1, 0),
| ^~~~~~~
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/uapi/linux/byteorder/little_endian.h:33:51: note: in definition of macro '__cpu_to_le32'
33 | #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
| ^
>> arch/arm/include/asm/io.h:307:36: note: in expansion of macro 'writel_relaxed'
307 | #define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
| ^~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:761:3: note: in expansion of macro 'writel'
761 | writel(EIP197_DxE_THR_CTRL_EN | GENMASK(priv->config.rings - 1, 0),
| ^~~~~~
include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
25 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:761:35: note: in expansion of macro 'GENMASK'
761 | writel(EIP197_DxE_THR_CTRL_EN | GENMASK(priv->config.rings - 1, 0),
| ^~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/uapi/linux/byteorder/little_endian.h:33:51: note: in definition of macro '__cpu_to_le32'
33 | #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
| ^
>> arch/arm/include/asm/io.h:307:36: note: in expansion of macro 'writel_relaxed'
307 | #define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
| ^~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:761:3: note: in expansion of macro 'writel'
761 | writel(EIP197_DxE_THR_CTRL_EN | GENMASK(priv->config.rings - 1, 0),
| ^~~~~~
include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
25 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~~~~~~~~~~~
drivers/crypto/inside-secure/safexcel.c:761:35: note: in expansion of macro 'GENMASK'
761 | writel(EIP197_DxE_THR_CTRL_EN | GENMASK(priv->config.rings - 1, 0),
| ^~~~~~~

vim +/GENMASK_ULL +871 drivers/clk/clk-stm32f4.c

358bdf892f6bfa Daniel Thompson 2015-06-10 846
358bdf892f6bfa Daniel Thompson 2015-06-10 847 /*
358bdf892f6bfa Daniel Thompson 2015-06-10 848 * Converts the primary and secondary indices (as they appear in DT) to an
358bdf892f6bfa Daniel Thompson 2015-06-10 849 * offset into our struct clock array.
358bdf892f6bfa Daniel Thompson 2015-06-10 850 */
358bdf892f6bfa Daniel Thompson 2015-06-10 851 static int stm32f4_rcc_lookup_clk_idx(u8 primary, u8 secondary)
358bdf892f6bfa Daniel Thompson 2015-06-10 852 {
a064a07f72e92c Gabriel Fernandez 2016-10-21 853 u64 table[MAX_GATE_MAP];
358bdf892f6bfa Daniel Thompson 2015-06-10 854
358bdf892f6bfa Daniel Thompson 2015-06-10 855 if (primary == 1) {
88c9b70bb2b218 Gabriel Fernandez 2017-01-06 856 if (WARN_ON(secondary >= stm32fx_end_primary_clk))
358bdf892f6bfa Daniel Thompson 2015-06-10 857 return -EINVAL;
358bdf892f6bfa Daniel Thompson 2015-06-10 858 return secondary;
358bdf892f6bfa Daniel Thompson 2015-06-10 859 }
358bdf892f6bfa Daniel Thompson 2015-06-10 860
a064a07f72e92c Gabriel Fernandez 2016-10-21 861 memcpy(table, stm32f4_gate_map, sizeof(table));
358bdf892f6bfa Daniel Thompson 2015-06-10 862
358bdf892f6bfa Daniel Thompson 2015-06-10 863 /* only bits set in table can be used as indices */
15ab38273d21a4 Daniel Thompson 2015-06-28 864 if (WARN_ON(secondary >= BITS_PER_BYTE * sizeof(table) ||
358bdf892f6bfa Daniel Thompson 2015-06-10 865 0 == (table[BIT_ULL_WORD(secondary)] &
358bdf892f6bfa Daniel Thompson 2015-06-10 866 BIT_ULL_MASK(secondary))))
358bdf892f6bfa Daniel Thompson 2015-06-10 867 return -EINVAL;
358bdf892f6bfa Daniel Thompson 2015-06-10 868
358bdf892f6bfa Daniel Thompson 2015-06-10 869 /* mask out bits above our current index */
358bdf892f6bfa Daniel Thompson 2015-06-10 870 table[BIT_ULL_WORD(secondary)] &=
358bdf892f6bfa Daniel Thompson 2015-06-10 @871 GENMASK_ULL(secondary % BITS_PER_LONG_LONG, 0);
358bdf892f6bfa Daniel Thompson 2015-06-10 872
88c9b70bb2b218 Gabriel Fernandez 2017-01-06 873 return stm32fx_end_primary_clk - 1 + hweight64(table[0]) +
358bdf892f6bfa Daniel Thompson 2015-06-10 874 (BIT_ULL_WORD(secondary) >= 1 ? hweight64(table[1]) : 0) +
358bdf892f6bfa Daniel Thompson 2015-06-10 875 (BIT_ULL_WORD(secondary) >= 2 ? hweight64(table[2]) : 0);
358bdf892f6bfa Daniel Thompson 2015-06-10 876 }
358bdf892f6bfa Daniel Thompson 2015-06-10 877

:::::: The code at line 871 was first introduced by commit
:::::: 358bdf892f6bfacf20884b54a35ab038321f06f9 clk: stm32: Add clock driver for STM32F4[23]xxx devices

:::::: TO: Daniel Thompson <daniel.thompson@xxxxxxxxxx>
:::::: CC: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip