[csky-linux:riscv_compat_v2_sv48_v3_mmind_pbmt 42/44] arch/riscv/kernel/setup.c:328:8: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'int'

From: kernel test robot
Date: Tue Jan 18 2022 - 13:42:10 EST


tree: https://github.com/c-sky/csky-linux riscv_compat_v2_sv48_v3_mmind_pbmt
head: b28a50c03a72c48d3895320bdd0757e0a8acb881
commit: 330ce3d4a3edd32464ac6deb817c211526c40781 [42/44] riscv: add RISC-V Svpbmt extension supports
config: riscv-randconfig-r042-20220117 (https://download.01.org/0day-ci/archive/20220119/202201190246.f3cvUQdo-lkp@xxxxxxxxx/config)
compiler: riscv32-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/c-sky/csky-linux/commit/330ce3d4a3edd32464ac6deb817c211526c40781
git remote add csky-linux https://github.com/c-sky/csky-linux
git fetch --no-tags csky-linux riscv_compat_v2_sv48_v3_mmind_pbmt
git checkout 330ce3d4a3edd32464ac6deb817c211526c40781
# 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=riscv SHELL=/bin/bash arch/riscv/kernel/

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

All warnings (new ones prefixed by >>):

arch/riscv/kernel/setup.c: In function 'free_initmem':
arch/riscv/kernel/setup.c:326:9: error: implicit declaration of function 'ALT_THEAD_PMA' [-Werror=implicit-function-declaration]
326 | ALT_THEAD_PMA(prot_val);
| ^~~~~~~~~~~~~
In file included from include/asm-generic/bug.h:22,
from arch/riscv/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/mm.h:9,
from arch/riscv/kernel/setup.c:12:
>> arch/riscv/kernel/setup.c:328:8: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
328 | printk("%s: _PAGE_IO: 0x%lx\n", __func__, _PAGE_IO);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:422:25: note: in definition of macro 'printk_index_wrap'
422 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
arch/riscv/kernel/setup.c:328:1: note: in expansion of macro 'printk'
328 | printk("%s: _PAGE_IO: 0x%lx\n", __func__, _PAGE_IO);
| ^~~~~~
arch/riscv/kernel/setup.c:328:27: note: format string is defined here
328 | printk("%s: _PAGE_IO: 0x%lx\n", __func__, _PAGE_IO);
| ~~^
| |
| long unsigned int
| %x
In file included from include/asm-generic/bug.h:22,
from arch/riscv/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/mm.h:9,
from arch/riscv/kernel/setup.c:12:
arch/riscv/kernel/setup.c:329:8: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
329 | printk("%s: _PAGE_NOCACHE: 0x%lx\n", __func__, _PAGE_NOCACHE);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:422:25: note: in definition of macro 'printk_index_wrap'
422 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
arch/riscv/kernel/setup.c:329:1: note: in expansion of macro 'printk'
329 | printk("%s: _PAGE_NOCACHE: 0x%lx\n", __func__, _PAGE_NOCACHE);
| ^~~~~~
arch/riscv/kernel/setup.c:329:32: note: format string is defined here
329 | printk("%s: _PAGE_NOCACHE: 0x%lx\n", __func__, _PAGE_NOCACHE);
| ~~^
| |
| long unsigned int
| %x
cc1: some warnings being treated as errors


vim +328 arch/riscv/kernel/setup.c

19a00869028f4a Atish Patra 2020-11-04 320
19a00869028f4a Atish Patra 2020-11-04 321 void free_initmem(void)
19a00869028f4a Atish Patra 2020-11-04 322 {
a8a0c8f014166b Heiko Stuebner 2021-12-17 323 unsigned long prot_val = pgprot_val(PAGE_KERNEL);
a8a0c8f014166b Heiko Stuebner 2021-12-17 324
a8a0c8f014166b Heiko Stuebner 2021-12-17 325 printk("%s: _PAGE_KERNEL-orig: 0x%lx\n", __func__, prot_val);
a8a0c8f014166b Heiko Stuebner 2021-12-17 326 ALT_THEAD_PMA(prot_val);
a8a0c8f014166b Heiko Stuebner 2021-12-17 327 printk("%s: _PAGE_KERNEL: 0x%lx\n", __func__, prot_val);
a8a0c8f014166b Heiko Stuebner 2021-12-17 @328 printk("%s: _PAGE_IO: 0x%lx\n", __func__, _PAGE_IO);

:::::: The code at line 328 was first introduced by commit
:::::: a8a0c8f014166b1e95e223240632fd0baac50ea7 hack in a debug output in freeinitmem

:::::: TO: Heiko Stuebner <heiko@xxxxxxxxx>
:::::: CC: Guo Ren <guoren@xxxxxxxxxxxxxxxxx>

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