arch/mips/kernel/spram.c:194:6: warning: no previous prototype for 'spram_config'

From: kernel test robot
Date: Fri Oct 06 2023 - 14:05:31 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: af95dc6fdc25e616051d0234aad638e15c02ec8f
commit: 51522217f65f1f937f421d9f417cf0e714ef3c02 MIPS: Loongson64: Bump ISA level to MIPSR2
date: 3 years, 8 months ago
config: mips-loongson3_defconfig (https://download.01.org/0day-ci/archive/20231007/202310070246.8CwDzTcs-lkp@xxxxxxxxx/config)
compiler: mips64el-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231007/202310070246.8CwDzTcs-lkp@xxxxxxxxx/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
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310070246.8CwDzTcs-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from include/linux/gfp.h:6,
from include/linux/mm.h:10,
from include/linux/pid_namespace.h:7,
from include/linux/ptrace.h:10,
from arch/mips/kernel/spram.c:8:
include/linux/mmzone.h: In function '__nr_to_section':
include/linux/mmzone.h:1255:13: warning: the comparison will always evaluate as 'true' for the address of 'mem_section' will never be NULL [-Waddress]
1255 | if (!mem_section[SECTION_NR_TO_ROOT(nr)])
| ^
include/linux/mmzone.h:1241:27: note: 'mem_section' declared here
1241 | extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT];
| ^~~~~~~~~~~
arch/mips/kernel/spram.c: At top level:
>> arch/mips/kernel/spram.c:194:6: warning: no previous prototype for 'spram_config' [-Wmissing-prototypes]
194 | void spram_config(void)
| ^~~~~~~~~~~~


vim +/spram_config +194 arch/mips/kernel/spram.c

0b6d497fcbb72b35 Chris Dearman 2007-09-13 112
078a55fc824c1633 Paul Gortmaker 2013-06-18 113 static void probe_spram(char *type,
0b6d497fcbb72b35 Chris Dearman 2007-09-13 114 unsigned int base,
0b6d497fcbb72b35 Chris Dearman 2007-09-13 115 unsigned int (*read)(unsigned int),
0b6d497fcbb72b35 Chris Dearman 2007-09-13 116 void (*write)(unsigned int, unsigned int))
0b6d497fcbb72b35 Chris Dearman 2007-09-13 117 {
0b6d497fcbb72b35 Chris Dearman 2007-09-13 118 unsigned int firstsize = 0, lastsize = 0;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 119 unsigned int firstpa = 0, lastpa = 0, pa = 0;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 120 unsigned int offset = 0;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 121 unsigned int size, tag0, tag1;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 122 unsigned int enabled;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 123 int i;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 124
0b6d497fcbb72b35 Chris Dearman 2007-09-13 125 /*
0b6d497fcbb72b35 Chris Dearman 2007-09-13 126 * The limit is arbitrary but avoids the loop running away if
0b6d497fcbb72b35 Chris Dearman 2007-09-13 127 * the SPRAM tags are implemented differently
0b6d497fcbb72b35 Chris Dearman 2007-09-13 128 */
0b6d497fcbb72b35 Chris Dearman 2007-09-13 129
0b6d497fcbb72b35 Chris Dearman 2007-09-13 130 for (i = 0; i < 8; i++) {
0b6d497fcbb72b35 Chris Dearman 2007-09-13 131 tag0 = read(offset);
0b6d497fcbb72b35 Chris Dearman 2007-09-13 132 tag1 = read(offset+SPRAM_TAG_STRIDE);
0b6d497fcbb72b35 Chris Dearman 2007-09-13 133 pr_debug("DBG %s%d: tag0=%08x tag1=%08x\n",
0b6d497fcbb72b35 Chris Dearman 2007-09-13 134 type, i, tag0, tag1);
0b6d497fcbb72b35 Chris Dearman 2007-09-13 135
0b6d497fcbb72b35 Chris Dearman 2007-09-13 136 size = tag1 & SPRAM_TAG1_SIZE_MASK;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 137
0b6d497fcbb72b35 Chris Dearman 2007-09-13 138 if (size == 0)
0b6d497fcbb72b35 Chris Dearman 2007-09-13 139 break;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 140
0b6d497fcbb72b35 Chris Dearman 2007-09-13 141 if (i != 0) {
0b6d497fcbb72b35 Chris Dearman 2007-09-13 142 /* tags may repeat... */
0b6d497fcbb72b35 Chris Dearman 2007-09-13 143 if ((pa == firstpa && size == firstsize) ||
0b6d497fcbb72b35 Chris Dearman 2007-09-13 144 (pa == lastpa && size == lastsize))
0b6d497fcbb72b35 Chris Dearman 2007-09-13 145 break;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 146 }
0b6d497fcbb72b35 Chris Dearman 2007-09-13 147
0b6d497fcbb72b35 Chris Dearman 2007-09-13 148 /* Align base with size */
0b6d497fcbb72b35 Chris Dearman 2007-09-13 149 base = (base + size - 1) & ~(size-1);
0b6d497fcbb72b35 Chris Dearman 2007-09-13 150
0b6d497fcbb72b35 Chris Dearman 2007-09-13 151 /* reprogram the base address base address and enable */
0b6d497fcbb72b35 Chris Dearman 2007-09-13 152 tag0 = (base & SPRAM_TAG0_PA_MASK) | SPRAM_TAG0_ENABLE;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 153 write(offset, tag0);
0b6d497fcbb72b35 Chris Dearman 2007-09-13 154
0b6d497fcbb72b35 Chris Dearman 2007-09-13 155 base += size;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 156
0b6d497fcbb72b35 Chris Dearman 2007-09-13 157 /* reread the tag */
0b6d497fcbb72b35 Chris Dearman 2007-09-13 158 tag0 = read(offset);
0b6d497fcbb72b35 Chris Dearman 2007-09-13 159 pa = tag0 & SPRAM_TAG0_PA_MASK;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 160 enabled = tag0 & SPRAM_TAG0_ENABLE;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 161
0b6d497fcbb72b35 Chris Dearman 2007-09-13 162 if (i == 0) {
0b6d497fcbb72b35 Chris Dearman 2007-09-13 163 firstpa = pa;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 164 firstsize = size;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 165 }
0b6d497fcbb72b35 Chris Dearman 2007-09-13 166
0b6d497fcbb72b35 Chris Dearman 2007-09-13 167 lastpa = pa;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 168 lastsize = size;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 169
0b6d497fcbb72b35 Chris Dearman 2007-09-13 170 if (strcmp(type, "DSPRAM") == 0) {
0b6d497fcbb72b35 Chris Dearman 2007-09-13 171 unsigned int *vp = (unsigned int *)(CKSEG1 | pa);
0b6d497fcbb72b35 Chris Dearman 2007-09-13 172 unsigned int v;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 173 #define TDAT 0x5a5aa5a5
0b6d497fcbb72b35 Chris Dearman 2007-09-13 174 vp[0] = TDAT;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 175 vp[1] = ~TDAT;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 176
0b6d497fcbb72b35 Chris Dearman 2007-09-13 177 mb();
0b6d497fcbb72b35 Chris Dearman 2007-09-13 178
0b6d497fcbb72b35 Chris Dearman 2007-09-13 179 v = vp[0];
0b6d497fcbb72b35 Chris Dearman 2007-09-13 180 if (v != TDAT)
0b6d497fcbb72b35 Chris Dearman 2007-09-13 181 printk(KERN_ERR "vp=%p wrote=%08x got=%08x\n",
0b6d497fcbb72b35 Chris Dearman 2007-09-13 182 vp, TDAT, v);
0b6d497fcbb72b35 Chris Dearman 2007-09-13 183 v = vp[1];
0b6d497fcbb72b35 Chris Dearman 2007-09-13 184 if (v != ~TDAT)
0b6d497fcbb72b35 Chris Dearman 2007-09-13 185 printk(KERN_ERR "vp=%p wrote=%08x got=%08x\n",
0b6d497fcbb72b35 Chris Dearman 2007-09-13 186 vp+1, ~TDAT, v);
0b6d497fcbb72b35 Chris Dearman 2007-09-13 187 }
0b6d497fcbb72b35 Chris Dearman 2007-09-13 188
0b6d497fcbb72b35 Chris Dearman 2007-09-13 189 pr_info("%s%d: PA=%08x,Size=%08x%s\n",
0b6d497fcbb72b35 Chris Dearman 2007-09-13 190 type, i, pa, size, enabled ? ",enabled" : "");
0b6d497fcbb72b35 Chris Dearman 2007-09-13 191 offset += 2 * SPRAM_TAG_STRIDE;
0b6d497fcbb72b35 Chris Dearman 2007-09-13 192 }
0b6d497fcbb72b35 Chris Dearman 2007-09-13 193 }
078a55fc824c1633 Paul Gortmaker 2013-06-18 @194 void spram_config(void)

:::::: The code at line 194 was first introduced by commit
:::::: 078a55fc824c1633b3a507e4ad48b4637c1dfc18 MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code

:::::: TO: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>
:::::: CC: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>

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