arch/m68k/kernel/uboot.c:67:43: warning: variable 'uboot_initrd_end' set but not used

From: kernel test robot
Date: Tue Apr 04 2023 - 01:51:24 EST


Hi Masami,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 148341f0a2f53b5e8808d093333d85170586a15d
commit: a2a9d67a26ec94a99ed29efbd61cf5be0a575678 bootconfig: Support embedding a bootconfig file in kernel
date: 11 months ago
config: m68k-buildonly-randconfig-r001-20230404 (https://download.01.org/0day-ci/archive/20230404/202304041351.UoS1HYnY-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 12.1.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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a2a9d67a26ec94a99ed29efbd61cf5be0a575678
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a2a9d67a26ec94a99ed29efbd61cf5be0a575678
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash arch/m68k/kernel/ drivers/clk/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202304041351.UoS1HYnY-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

arch/m68k/kernel/uboot.c: In function 'parse_uboot_commandline':
>> arch/m68k/kernel/uboot.c:67:43: warning: variable 'uboot_initrd_end' set but not used [-Wunused-but-set-variable]
67 | unsigned long uboot_initrd_start, uboot_initrd_end;
| ^~~~~~~~~~~~~~~~
>> arch/m68k/kernel/uboot.c:67:23: warning: variable 'uboot_initrd_start' set but not used [-Wunused-but-set-variable]
67 | unsigned long uboot_initrd_start, uboot_initrd_end;
| ^~~~~~~~~~~~~~~~~~
arch/m68k/kernel/uboot.c:66:23: warning: variable 'uboot_kbd' set but not used [-Wunused-but-set-variable]
66 | unsigned long uboot_kbd;
| ^~~~~~~~~
arch/m68k/kernel/uboot.c: At top level:
arch/m68k/kernel/uboot.c:90:13: warning: no previous prototype for 'process_uboot_commandline' [-Wmissing-prototypes]
90 | __init void process_uboot_commandline(char *commandp, int size)
| ^~~~~~~~~~~~~~~~~~~~~~~~~


vim +/uboot_initrd_end +67 arch/m68k/kernel/uboot.c

aa5ac789bd96c7 Greg Ungerer 2016-09-05 30
aa5ac789bd96c7 Greg Ungerer 2016-09-05 31 /*
aa5ac789bd96c7 Greg Ungerer 2016-09-05 32 * parse_uboot_commandline
aa5ac789bd96c7 Greg Ungerer 2016-09-05 33 *
aa5ac789bd96c7 Greg Ungerer 2016-09-05 34 * Copies u-boot commandline arguments and store them in the proper linux
aa5ac789bd96c7 Greg Ungerer 2016-09-05 35 * variables.
aa5ac789bd96c7 Greg Ungerer 2016-09-05 36 *
aa5ac789bd96c7 Greg Ungerer 2016-09-05 37 * Assumes:
aa5ac789bd96c7 Greg Ungerer 2016-09-05 38 * _init_sp global contains the address in the stack pointer when the
aa5ac789bd96c7 Greg Ungerer 2016-09-05 39 * kernel starts (see head.S::_start)
aa5ac789bd96c7 Greg Ungerer 2016-09-05 40 *
aa5ac789bd96c7 Greg Ungerer 2016-09-05 41 * U-Boot calling convention:
aa5ac789bd96c7 Greg Ungerer 2016-09-05 42 * (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
aa5ac789bd96c7 Greg Ungerer 2016-09-05 43 *
aa5ac789bd96c7 Greg Ungerer 2016-09-05 44 * _init_sp can be parsed as such
aa5ac789bd96c7 Greg Ungerer 2016-09-05 45 *
aa5ac789bd96c7 Greg Ungerer 2016-09-05 46 * _init_sp+00 = u-boot cmd after jsr into kernel (skip)
aa5ac789bd96c7 Greg Ungerer 2016-09-05 47 * _init_sp+04 = &kernel board_info (residual data)
aa5ac789bd96c7 Greg Ungerer 2016-09-05 48 * _init_sp+08 = &initrd_start
aa5ac789bd96c7 Greg Ungerer 2016-09-05 49 * _init_sp+12 = &initrd_end
aa5ac789bd96c7 Greg Ungerer 2016-09-05 50 * _init_sp+16 = &cmd_start
aa5ac789bd96c7 Greg Ungerer 2016-09-05 51 * _init_sp+20 = &cmd_end
aa5ac789bd96c7 Greg Ungerer 2016-09-05 52 *
aa5ac789bd96c7 Greg Ungerer 2016-09-05 53 * This also assumes that the memory locations pointed to are still
aa5ac789bd96c7 Greg Ungerer 2016-09-05 54 * unmodified. U-boot places them near the end of external SDRAM.
aa5ac789bd96c7 Greg Ungerer 2016-09-05 55 *
aa5ac789bd96c7 Greg Ungerer 2016-09-05 56 * Argument(s):
aa5ac789bd96c7 Greg Ungerer 2016-09-05 57 * commandp = the linux commandline arg container to fill.
aa5ac789bd96c7 Greg Ungerer 2016-09-05 58 * size = the sizeof commandp.
aa5ac789bd96c7 Greg Ungerer 2016-09-05 59 *
aa5ac789bd96c7 Greg Ungerer 2016-09-05 60 * Returns:
aa5ac789bd96c7 Greg Ungerer 2016-09-05 61 */
aa5ac789bd96c7 Greg Ungerer 2016-09-05 62 static void __init parse_uboot_commandline(char *commandp, int size)
aa5ac789bd96c7 Greg Ungerer 2016-09-05 63 {
aa5ac789bd96c7 Greg Ungerer 2016-09-05 64 extern unsigned long _init_sp;
aa5ac789bd96c7 Greg Ungerer 2016-09-05 65 unsigned long *sp;
aa5ac789bd96c7 Greg Ungerer 2016-09-05 66 unsigned long uboot_kbd;
aa5ac789bd96c7 Greg Ungerer 2016-09-05 @67 unsigned long uboot_initrd_start, uboot_initrd_end;
aa5ac789bd96c7 Greg Ungerer 2016-09-05 68 unsigned long uboot_cmd_start, uboot_cmd_end;
aa5ac789bd96c7 Greg Ungerer 2016-09-05 69
aa5ac789bd96c7 Greg Ungerer 2016-09-05 70 sp = (unsigned long *)_init_sp;
aa5ac789bd96c7 Greg Ungerer 2016-09-05 71 uboot_kbd = sp[1];
aa5ac789bd96c7 Greg Ungerer 2016-09-05 72 uboot_initrd_start = sp[2];
aa5ac789bd96c7 Greg Ungerer 2016-09-05 73 uboot_initrd_end = sp[3];
aa5ac789bd96c7 Greg Ungerer 2016-09-05 74 uboot_cmd_start = sp[4];
aa5ac789bd96c7 Greg Ungerer 2016-09-05 75 uboot_cmd_end = sp[5];
aa5ac789bd96c7 Greg Ungerer 2016-09-05 76
aa5ac789bd96c7 Greg Ungerer 2016-09-05 77 if (uboot_cmd_start && uboot_cmd_end)
aa5ac789bd96c7 Greg Ungerer 2016-09-05 78 strncpy(commandp, (const char *)uboot_cmd_start, size);
aa5ac789bd96c7 Greg Ungerer 2016-09-05 79 #if defined(CONFIG_BLK_DEV_INITRD)
aa5ac789bd96c7 Greg Ungerer 2016-09-05 80 if (uboot_initrd_start && uboot_initrd_end &&
aa5ac789bd96c7 Greg Ungerer 2016-09-05 81 (uboot_initrd_end > uboot_initrd_start)) {
aa5ac789bd96c7 Greg Ungerer 2016-09-05 82 initrd_start = uboot_initrd_start;
aa5ac789bd96c7 Greg Ungerer 2016-09-05 83 initrd_end = uboot_initrd_end;
aa5ac789bd96c7 Greg Ungerer 2016-09-05 84 ROOT_DEV = Root_RAM0;
7c79e1eef8c9a7 Geert Uytterhoeven 2016-12-06 85 pr_info("initrd at 0x%lx:0x%lx\n", initrd_start, initrd_end);
aa5ac789bd96c7 Greg Ungerer 2016-09-05 86 }
aa5ac789bd96c7 Greg Ungerer 2016-09-05 87 #endif /* if defined(CONFIG_BLK_DEV_INITRD) */
aa5ac789bd96c7 Greg Ungerer 2016-09-05 88 }
aa5ac789bd96c7 Greg Ungerer 2016-09-05 89

:::::: The code at line 67 was first introduced by commit
:::::: aa5ac789bd96c7a6628a8167de562fa660f1f481 m68k: generalize uboot command line support

:::::: TO: Greg Ungerer <gerg@xxxxxxxxxxxxxx>
:::::: CC: Greg Ungerer <gerg@xxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests