./scripts/checkpatch.pl --no-tree -f init/main.c
ERROR: Use of const init definition must use __initconst
+static const char *initcall_level_names[] __initdata = {
Signed-off-by: jingyuwang <[email protected]>
---
init/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init/main.c b/init/main.c
index 0ee39cdcfcac..dc6188a3dd4e 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1336,7 +1336,7 @@ static initcall_entry_t *initcall_levels[] __initdata = {
};
/* Keep these in sync with initcalls in include/linux/init.h */
-static const char *initcall_level_names[] __initdata = {
+static const char *initcall_level_names[] __initconst = {
"pure",
"core",
"postcore",
--
2.34.1
Hi jingyuwang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master v5.19-rc2 next-20220610]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/jingyuwang/Fix-the-following-checkpatch-error/20220614-050258
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20220614/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/35742a839670fa8937c7040160e16b7009b2a9ae
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review jingyuwang/Fix-the-following-checkpatch-error/20220614-050258
git checkout 35742a839670fa8937c7040160e16b7009b2a9ae
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
init/main.c:773:20: warning: no previous prototype for 'arch_post_acpi_subsys_init' [-Wmissing-prototypes]
773 | void __init __weak arch_post_acpi_subsys_init(void) { }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
init/main.c:785:20: warning: no previous prototype for 'mem_encrypt_init' [-Wmissing-prototypes]
785 | void __init __weak mem_encrypt_init(void) { }
| ^~~~~~~~~~~~~~~~
init/main.c:787:20: warning: no previous prototype for 'poking_init' [-Wmissing-prototypes]
787 | void __init __weak poking_init(void) { }
| ^~~~~~~~~~~
In file included from include/linux/printk.h:6,
from include/linux/kernel.h:29,
from include/linux/cpumask.h:10,
from include/linux/mm_types_task.h:14,
from include/linux/mm_types.h:5,
from include/linux/buildid.h:5,
from include/linux/module.h:14,
from init/main.c:17:
>> include/linux/init.h:316:27: error: '__setup_str_initcall_blacklist' causes a section type conflict with 'initcall_level_names'
316 | static const char __setup_str_##unique_id[] __initconst \
| ^~~~~~~~~~~~
include/linux/init.h:329:9: note: in expansion of macro '__setup_param'
329 | __setup_param(str, fn, fn, 0)
| ^~~~~~~~~~~~~
init/main.c:1239:1: note: in expansion of macro '__setup'
1239 | __setup("initcall_blacklist=", initcall_blacklist);
| ^~~~~~~
init/main.c:1344:20: note: 'initcall_level_names' was declared here
1344 | static const char *initcall_level_names[] __initconst = {
| ^~~~~~~~~~~~~~~~~~~~
vim +316 include/linux/init.h
^1da177e4c3f41 Linus Torvalds 2005-04-16 308
^1da177e4c3f41 Linus Torvalds 2005-04-16 309 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 310 * Only for really core code. See moduleparam.h for the normal way.
^1da177e4c3f41 Linus Torvalds 2005-04-16 311 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 312 * Force the alignment so the compiler doesn't space elements of the
^1da177e4c3f41 Linus Torvalds 2005-04-16 313 * obs_kernel_param "array" too far apart in .init.setup.
^1da177e4c3f41 Linus Torvalds 2005-04-16 314 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 315 #define __setup_param(str, unique_id, fn, early) \
fd6c3a8dc44329 Jan Beulich 2009-03-12 @316 static const char __setup_str_##unique_id[] __initconst \
fd6c3a8dc44329 Jan Beulich 2009-03-12 317 __aligned(1) = str; \
^1da177e4c3f41 Linus Torvalds 2005-04-16 318 static struct obs_kernel_param __setup_##unique_id \
33def8498fdde1 Joe Perches 2020-10-21 319 __used __section(".init.setup") \
147ad605dc12c5 Johan Hovold 2020-11-23 320 __aligned(__alignof__(struct obs_kernel_param)) \
^1da177e4c3f41 Linus Torvalds 2005-04-16 321 = { __setup_str_##unique_id, fn, early }
^1da177e4c3f41 Linus Torvalds 2005-04-16 322
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Hi jingyuwang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master v5.19-rc2 next-20220610]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/jingyuwang/Fix-the-following-checkpatch-error/20220614-050258
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
config: hexagon-randconfig-r041-20220613 (https://download.01.org/0day-ci/archive/20220614/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c97436f8b6e2718286e8496faf53a2c800e281cf)
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/intel-lab-lkp/linux/commit/35742a839670fa8937c7040160e16b7009b2a9ae
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review jingyuwang/Fix-the-following-checkpatch-error/20220614-050258
git checkout 35742a839670fa8937c7040160e16b7009b2a9ae
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
init/main.c:773:20: warning: no previous prototype for function 'arch_post_acpi_subsys_init' [-Wmissing-prototypes]
void __init __weak arch_post_acpi_subsys_init(void) { }
^
init/main.c:773:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __init __weak arch_post_acpi_subsys_init(void) { }
^
static
init/main.c:785:20: warning: no previous prototype for function 'mem_encrypt_init' [-Wmissing-prototypes]
void __init __weak mem_encrypt_init(void) { }
^
init/main.c:785:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __init __weak mem_encrypt_init(void) { }
^
static
init/main.c:787:20: warning: no previous prototype for function 'poking_init' [-Wmissing-prototypes]
void __init __weak poking_init(void) { }
^
init/main.c:787:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __init __weak poking_init(void) { }
^
static
>> init/main.c:1344:20: error: 'initcall_level_names' causes a section type conflict with '__setup_str_set_reset_devices'
static const char *initcall_level_names[] __initconst = {
^
init/main.c:191:1: note: declared here
__setup("reset_devices", set_reset_devices);
^
include/linux/init.h:329:2: note: expanded from macro '__setup'
__setup_param(str, fn, fn, 0)
^
include/linux/init.h:316:20: note: expanded from macro '__setup_param'
static const char __setup_str_##unique_id[] __initconst \
^
<scratch space>:58:1: note: expanded from here
__setup_str_set_reset_devices
^
3 warnings and 1 error generated.
vim +1344 init/main.c
1342
1343 /* Keep these in sync with initcalls in include/linux/init.h */
> 1344 static const char *initcall_level_names[] __initconst = {
1345 "pure",
1346 "core",
1347 "postcore",
1348 "arch",
1349 "subsys",
1350 "fs",
1351 "device",
1352 "late",
1353 };
1354
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Hi jingyuwang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master v5.19-rc2 next-20220610]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/jingyuwang/Fix-the-following-checkpatch-error/20220614-050258
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
config: s390-randconfig-r044-20220613 (https://download.01.org/0day-ci/archive/20220614/[email protected]/config)
compiler: s390-linux-gcc (GCC) 11.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/intel-lab-lkp/linux/commit/35742a839670fa8937c7040160e16b7009b2a9ae
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review jingyuwang/Fix-the-following-checkpatch-error/20220614-050258
git checkout 35742a839670fa8937c7040160e16b7009b2a9ae
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
init/main.c:773:20: warning: no previous prototype for 'arch_post_acpi_subsys_init' [-Wmissing-prototypes]
773 | void __init __weak arch_post_acpi_subsys_init(void) { }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
init/main.c:785:20: warning: no previous prototype for 'mem_encrypt_init' [-Wmissing-prototypes]
785 | void __init __weak mem_encrypt_init(void) { }
| ^~~~~~~~~~~~~~~~
init/main.c:787:20: warning: no previous prototype for 'poking_init' [-Wmissing-prototypes]
787 | void __init __weak poking_init(void) { }
| ^~~~~~~~~~~
In file included from include/linux/printk.h:6,
from include/asm-generic/bug.h:22,
from arch/s390/include/asm/bug.h:69,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from arch/s390/include/asm/preempt.h:6,
from include/linux/preempt.h:78,
from arch/s390/include/asm/timex.h:13,
from include/linux/timex.h:67,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from init/main.c:17:
>> include/linux/init.h:316:27: error: '__setup_str_set_debug_rodata' causes a section type conflict with 'initcall_level_names'
316 | static const char __setup_str_##unique_id[] __initconst \
| ^~~~~~~~~~~~
include/linux/init.h:329:9: note: in expansion of macro '__setup_param'
329 | __setup_param(str, fn, fn, 0)
| ^~~~~~~~~~~~~
init/main.c:1461:1: note: in expansion of macro '__setup'
1461 | __setup("rodata=", set_debug_rodata);
| ^~~~~~~
init/main.c:1344:20: note: 'initcall_level_names' was declared here
1344 | static const char *initcall_level_names[] __initconst = {
| ^~~~~~~~~~~~~~~~~~~~
vim +316 include/linux/init.h
^1da177e4c3f415 Linus Torvalds 2005-04-16 308
^1da177e4c3f415 Linus Torvalds 2005-04-16 309 /*
^1da177e4c3f415 Linus Torvalds 2005-04-16 310 * Only for really core code. See moduleparam.h for the normal way.
^1da177e4c3f415 Linus Torvalds 2005-04-16 311 *
^1da177e4c3f415 Linus Torvalds 2005-04-16 312 * Force the alignment so the compiler doesn't space elements of the
^1da177e4c3f415 Linus Torvalds 2005-04-16 313 * obs_kernel_param "array" too far apart in .init.setup.
^1da177e4c3f415 Linus Torvalds 2005-04-16 314 */
^1da177e4c3f415 Linus Torvalds 2005-04-16 315 #define __setup_param(str, unique_id, fn, early) \
fd6c3a8dc44329d Jan Beulich 2009-03-12 @316 static const char __setup_str_##unique_id[] __initconst \
fd6c3a8dc44329d Jan Beulich 2009-03-12 317 __aligned(1) = str; \
^1da177e4c3f415 Linus Torvalds 2005-04-16 318 static struct obs_kernel_param __setup_##unique_id \
33def8498fdde18 Joe Perches 2020-10-21 319 __used __section(".init.setup") \
147ad605dc12c51 Johan Hovold 2020-11-23 320 __aligned(__alignof__(struct obs_kernel_param)) \
^1da177e4c3f415 Linus Torvalds 2005-04-16 321 = { __setup_str_##unique_id, fn, early }
^1da177e4c3f415 Linus Torvalds 2005-04-16 322
--
0-DAY CI Kernel Test Service
https://01.org/lkp