Re: [PATCH -next] misc: use DIV_ROUND_UP macro to do calculation

From: kernel test robot
Date: Mon Dec 28 2020 - 21:42:56 EST


Hi Zheng,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20201222]

url: https://github.com/0day-ci/linux/commits/Zheng-Yongjun/misc-use-DIV_ROUND_UP-macro-to-do-calculation/20201222-220138
base: 6c3eb1b174c07bcaa927003e8bc91e81ab1d5a9e
config: microblaze-randconfig-r022-20201221 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.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/0day-ci/linux/commit/5b74808b6866933e6adc4d6475429e77c3ccbb23
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Zheng-Yongjun/misc-use-DIV_ROUND_UP-macro-to-do-calculation/20201222-220138
git checkout 5b74808b6866933e6adc4d6475429e77c3ccbb23
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze

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

All errors (new ones prefixed by >>):

In file included from include/vdso/const.h:5,
from include/linux/const.h:4,
from include/linux/bits.h:5,
from include/linux/bitops.h:6,
from include/linux/kernel.h:11,
from drivers/misc/kgdbts.c:85:
>> drivers/misc/kgdbts.c:143:31: error: expected ')' before 'i'
143 | sizeof(unsigned long)i)];
| ^
include/uapi/linux/const.h:34:46: note: in definition of macro '__KERNEL_DIV_ROUND_UP'
34 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
| ^
drivers/misc/kgdbts.c:142:38: note: in expansion of macro 'DIV_ROUND_UP'
142 | static unsigned long kgdbts_gdb_regs[DIV_ROUND_UP(NUMREGBYTES,
| ^~~~~~~~~~~~
include/uapi/linux/const.h:34:45: note: to match this '('
34 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
| ^
include/linux/math.h:36:22: note: in expansion of macro '__KERNEL_DIV_ROUND_UP'
36 | #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
| ^~~~~~~~~~~~~~~~~~~~~
drivers/misc/kgdbts.c:142:38: note: in expansion of macro 'DIV_ROUND_UP'
142 | static unsigned long kgdbts_gdb_regs[DIV_ROUND_UP(NUMREGBYTES,
| ^~~~~~~~~~~~
>> drivers/misc/kgdbts.c:143:31: error: expected ')' before 'i'
143 | sizeof(unsigned long)i)];
| ^
include/uapi/linux/const.h:34:57: note: in definition of macro '__KERNEL_DIV_ROUND_UP'
34 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
| ^
drivers/misc/kgdbts.c:142:38: note: in expansion of macro 'DIV_ROUND_UP'
142 | static unsigned long kgdbts_gdb_regs[DIV_ROUND_UP(NUMREGBYTES,
| ^~~~~~~~~~~~
include/uapi/linux/const.h:34:56: note: to match this '('
34 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
| ^
include/linux/math.h:36:22: note: in expansion of macro '__KERNEL_DIV_ROUND_UP'
36 | #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
| ^~~~~~~~~~~~~~~~~~~~~
drivers/misc/kgdbts.c:142:38: note: in expansion of macro 'DIV_ROUND_UP'
142 | static unsigned long kgdbts_gdb_regs[DIV_ROUND_UP(NUMREGBYTES,
| ^~~~~~~~~~~~


vim +143 drivers/misc/kgdbts.c

140
141 /* Storage for the registers, in GDB format. */
142 static unsigned long kgdbts_gdb_regs[DIV_ROUND_UP(NUMREGBYTES,
> 143 sizeof(unsigned long)i)];
144 static struct pt_regs kgdbts_regs;
145

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

Attachment: .config.gz
Description: application/gzip