drivers/net/dsa/yt921x.c:1601:9: error: call to '__compiletime_assert_831' declared with 'error' attribute: FIELD_PREP: value too large for the field

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
:::::: 
:::::: Manual check reason: "__compiletime_assert_NNN"
:::::: 

BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: David Yang <[email protected]>
CC: Jakub Kicinski <[email protected]>

Hi David,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fce2dfa773ced15f27dd27cd0b482a7473cdcf2a
commit: 186623f4aa724c46cbb4dbd5235cf6942215f5b5 net: dsa: yt921x: Add support for Motorcomm YT921x
date:   9 months ago
:::::: branch date: 12 hours ago
:::::: commit date: 9 months ago
config: um-randconfig-r134-20260717 (https://download.01.org/0day-ci/archive/20260717/[email protected]/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260717/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 186623f4aa72 ("net: dsa: yt921x: Add support for Motorcomm YT921x")
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

All errors (new ones prefixed by >>):

   In file included from drivers/net/dsa/yt921x.c:11:
   In file included from include/linux/etherdevice.h:20:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/um/include/asm/hardirq.h:5:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:12:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:1209:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
    1209 |         return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
         |                                                   ~~~~~~~~~~ ^
>> drivers/net/dsa/yt921x.c:1601:9: error: call to '__compiletime_assert_831' declared with 'error' attribute: FIELD_PREP: value too large for the field
    1601 |         ctrl = YT921X_PORT_VLAN_CTRL_CVID(vid);
         |                ^
   drivers/net/dsa/yt921x.h:363:43: note: expanded from macro 'YT921X_PORT_VLAN_CTRL_CVID'
     363 | #define   YT921X_PORT_VLAN_CTRL_CVID(x)                 FIELD_PREP(YT921X_PORT_VLAN_CTRL_CVID_M, (x))
         |                                                         ^
   include/linux/bitfield.h:115:3: note: expanded from macro 'FIELD_PREP'
     115 |                 __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: ");    \
         |                 ^
   include/linux/bitfield.h:68:3: note: expanded from macro '__BF_FIELD_CHECK'
      68 |                 BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ?           \
         |                 ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:585:2: note: expanded from macro '_compiletime_assert'
     585 |         __compiletime_assert(condition, msg, prefix, suffix)
         |         ^
   include/linux/compiler_types.h:578:4: note: expanded from macro '__compiletime_assert'
     578 |                         prefix ## suffix();                             \
         |                         ^
   <scratch space>:46:1: note: expanded from here
      46 | __compiletime_assert_831
         | ^
   1 warning and 1 error generated.


vim +1601 drivers/net/dsa/yt921x.c

186623f4aa724c David Yang 2025-10-17  1593  
186623f4aa724c David Yang 2025-10-17  1594  static int
186623f4aa724c David Yang 2025-10-17  1595  yt921x_port_set_pvid(struct yt921x_priv *priv, int port, u16 vid)
186623f4aa724c David Yang 2025-10-17  1596  {
186623f4aa724c David Yang 2025-10-17  1597  	u32 mask;
186623f4aa724c David Yang 2025-10-17  1598  	u32 ctrl;
186623f4aa724c David Yang 2025-10-17  1599  
186623f4aa724c David Yang 2025-10-17  1600  	mask = YT921X_PORT_VLAN_CTRL_CVID_M;
186623f4aa724c David Yang 2025-10-17 @1601  	ctrl = YT921X_PORT_VLAN_CTRL_CVID(vid);
186623f4aa724c David Yang 2025-10-17  1602  	return yt921x_reg_update_bits(priv, YT921X_PORTn_VLAN_CTRL(port),
186623f4aa724c David Yang 2025-10-17  1603  				      mask, ctrl);
186623f4aa724c David Yang 2025-10-17  1604  }
186623f4aa724c David Yang 2025-10-17  1605  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.