[ammarfaizi2-block:axboe/linux-block/m1/2022-02-19 543/552] include/linux/bits.h:35:29: warning: left shift count >= width of type

From: kernel test robot
Date: Mon Feb 21 2022 - 16:49:47 EST


tree: https://github.com/ammarfaizi2/linux-block axboe/linux-block/m1/2022-02-19
head: b781e0ccdc0c9a931571d15db09d45b7258b9905
commit: 501bccfe4c2d4d9524d8cafcdd4e84b7c58e976a [543/552] Merge branches 'refs/heads/bits/000-devicetree', 'refs/heads/bits/010-mailbox', 'refs/heads/bits/020-t6000-bringup', 'refs/heads/bits/030-misc', 'refs/heads/bits/050-nvme', 'refs/heads/bits/060-spi', 'refs/heads/bits/070-audio', 'refs/heads/bits/080-wifi', 'refs/heads/bits/090-spi-hid', 'refs/heads/bits/100-shutdown-notifier', 'refs/heads/bits/110-smc', 'refs/heads/bits/120-spmi', 'refs/heads/bits/130-cpufreq' and 'refs/heads/bits/140-pci-pwren' into asahi
config: csky-allyesconfig (https://download.01.org/0day-ci/archive/20220222/202202220539.UAUVgANe-lkp@xxxxxxxxx/config)
compiler: csky-linux-gcc (GCC) 11.2.0
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
# https://github.com/ammarfaizi2/linux-block/commit/501bccfe4c2d4d9524d8cafcdd4e84b7c58e976a
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block axboe/linux-block/m1/2022-02-19
git checkout 501bccfe4c2d4d9524d8cafcdd4e84b7c58e976a
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=csky SHELL=/bin/bash drivers/platform/apple/

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

All warnings (new ones prefixed by >>):

drivers/platform/apple/smc_rtkit.c: In function 'apple_smc_rtkit_write_key_atomic':
drivers/platform/apple/smc_rtkit.c:73:16: error: implicit declaration of function 'FIELD_PREP' [-Werror=implicit-function-declaration]
73 | msg = (FIELD_PREP(SMC_MSG, SMC_MSG_WRITE_KEY) |
| ^~~~~~~~~~
In file included from include/linux/ratelimit_types.h:5,
from include/linux/ratelimit.h:5,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from drivers/platform/apple/smc_rtkit.c:8:
>> include/linux/bits.h:35:29: warning: left shift count >= width of type [-Wshift-count-overflow]
35 | (((~UL(0)) - (UL(1) << (l)) + 1) & \
| ^~
include/linux/bits.h:38:38: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:41: note: in expansion of macro 'GENMASK'
29 | #define SMC_DATA GENMASK(63, 32)
| ^~~~~~~
drivers/platform/apple/smc_rtkit.c:76:27: note: in expansion of macro 'SMC_DATA'
76 | FIELD_PREP(SMC_DATA, key));
| ^~~~~~~~
>> include/linux/bits.h:36:18: warning: right shift count is negative [-Wshift-count-negative]
36 | (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
| ^~
include/linux/bits.h:38:38: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:41: note: in expansion of macro 'GENMASK'
29 | #define SMC_DATA GENMASK(63, 32)
| ^~~~~~~
drivers/platform/apple/smc_rtkit.c:76:27: note: in expansion of macro 'SMC_DATA'
76 | FIELD_PREP(SMC_DATA, key));
| ^~~~~~~~
drivers/platform/apple/smc_rtkit.c:93:13: error: implicit declaration of function 'FIELD_GET' [-Werror=implicit-function-declaration]
93 | if (FIELD_GET(SMC_ID, smc->cmd_ret) != smc->msg_id) {
| ^~~~~~~~~
In file included from include/linux/ratelimit_types.h:5,
from include/linux/ratelimit.h:5,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from drivers/platform/apple/smc_rtkit.c:8:
drivers/platform/apple/smc_rtkit.c: In function 'apple_smc_cmd':
>> include/linux/bits.h:35:29: warning: left shift count >= width of type [-Wshift-count-overflow]
35 | (((~UL(0)) - (UL(1) << (l)) + 1) & \
| ^~
include/linux/bits.h:38:38: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:41: note: in expansion of macro 'GENMASK'
29 | #define SMC_DATA GENMASK(63, 32)
| ^~~~~~~
drivers/platform/apple/smc_rtkit.c:123:27: note: in expansion of macro 'SMC_DATA'
123 | FIELD_PREP(SMC_DATA, arg));
| ^~~~~~~~
>> include/linux/bits.h:36:18: warning: right shift count is negative [-Wshift-count-negative]
36 | (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
| ^~
include/linux/bits.h:38:38: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:41: note: in expansion of macro 'GENMASK'
29 | #define SMC_DATA GENMASK(63, 32)
| ^~~~~~~
drivers/platform/apple/smc_rtkit.c:123:27: note: in expansion of macro 'SMC_DATA'
123 | FIELD_PREP(SMC_DATA, arg));
| ^~~~~~~~
>> include/linux/bits.h:35:29: warning: left shift count >= width of type [-Wshift-count-overflow]
35 | (((~UL(0)) - (UL(1) << (l)) + 1) & \
| ^~
include/linux/bits.h:38:38: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:41: note: in expansion of macro 'GENMASK'
29 | #define SMC_DATA GENMASK(63, 32)
| ^~~~~~~
drivers/platform/apple/smc_rtkit.c:147:39: note: in expansion of macro 'SMC_DATA'
147 | *ret_data = FIELD_GET(SMC_DATA, smc->cmd_ret);
| ^~~~~~~~
>> include/linux/bits.h:36:18: warning: right shift count is negative [-Wshift-count-negative]
36 | (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
| ^~
include/linux/bits.h:38:38: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:41: note: in expansion of macro 'GENMASK'
29 | #define SMC_DATA GENMASK(63, 32)
| ^~~~~~~
drivers/platform/apple/smc_rtkit.c:147:39: note: in expansion of macro 'SMC_DATA'
147 | *ret_data = FIELD_GET(SMC_DATA, smc->cmd_ret);
| ^~~~~~~~
drivers/platform/apple/smc_rtkit.c: In function 'apple_smc_rtkit_recv':
>> include/linux/bits.h:35:29: warning: left shift count >= width of type [-Wshift-count-overflow]
35 | (((~UL(0)) - (UL(1) << (l)) + 1) & \
| ^~
include/linux/bits.h:38:38: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:41: note: in expansion of macro 'GENMASK'
29 | #define SMC_DATA GENMASK(63, 32)
| ^~~~~~~
drivers/platform/apple/smc_rtkit.c:327:55: note: in expansion of macro 'SMC_DATA'
327 | apple_smc_event_received(smc->core, FIELD_GET(SMC_DATA, message));
| ^~~~~~~~
>> include/linux/bits.h:36:18: warning: right shift count is negative [-Wshift-count-negative]
36 | (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
| ^~
include/linux/bits.h:38:38: note: in expansion of macro '__GENMASK'
38 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
| ^~~~~~~~~
drivers/platform/apple/smc_rtkit.c:29:41: note: in expansion of macro 'GENMASK'
29 | #define SMC_DATA GENMASK(63, 32)
| ^~~~~~~
drivers/platform/apple/smc_rtkit.c:327:55: note: in expansion of macro 'SMC_DATA'
327 | apple_smc_event_received(smc->core, FIELD_GET(SMC_DATA, message));
| ^~~~~~~~
cc1: some warnings being treated as errors


vim +35 include/linux/bits.h

295bcca84916cb Rikard Falkeborn 2020-04-06 33
295bcca84916cb Rikard Falkeborn 2020-04-06 34 #define __GENMASK(h, l) \
95b980d62d52c4 Masahiro Yamada 2019-07-16 @35 (((~UL(0)) - (UL(1) << (l)) + 1) & \
95b980d62d52c4 Masahiro Yamada 2019-07-16 @36 (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
295bcca84916cb Rikard Falkeborn 2020-04-06 37 #define GENMASK(h, l) \
295bcca84916cb Rikard Falkeborn 2020-04-06 38 (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
8bd9cb51daac89 Will Deacon 2018-06-19 39

:::::: The code at line 35 was first introduced by commit
:::::: 95b980d62d52c4c1768ee719e8db3efe27ef52b2 linux/bits.h: make BIT(), GENMASK(), and friends available in assembly

:::::: TO: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

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