arch/nds32/kernel/setup.c:247:26: warning: Unused variable: region [unusedVariable]

From: kernel test robot
Date: Mon Jul 12 2021 - 05:27:32 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 50be9417e23af5a8ac860d998e1e3f06b8fd79d7
commit: 80c4574417ae42fe2ba6978772854dc67cfc5331 h8300, nds32, openrisc: simplify detection of memory extents
date: 9 months ago
compiler: nds32le-linux-gcc (GCC) 9.3.0

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


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> arch/nds32/kernel/setup.c:247:26: warning: Unused variable: region [unusedVariable]
struct memblock_region *region;
^

vim +247 arch/nds32/kernel/setup.c

001d953ede35df Greentime Hu 2017-10-24 241
001d953ede35df Greentime Hu 2017-10-24 242 static void __init setup_memory(void)
001d953ede35df Greentime Hu 2017-10-24 243 {
001d953ede35df Greentime Hu 2017-10-24 244 unsigned long ram_start_pfn;
001d953ede35df Greentime Hu 2017-10-24 245 unsigned long free_ram_start_pfn;
001d953ede35df Greentime Hu 2017-10-24 246 phys_addr_t memory_start, memory_end;
001d953ede35df Greentime Hu 2017-10-24 @247 struct memblock_region *region;
001d953ede35df Greentime Hu 2017-10-24 248
001d953ede35df Greentime Hu 2017-10-24 249 memory_end = memory_start = 0;
001d953ede35df Greentime Hu 2017-10-24 250
001d953ede35df Greentime Hu 2017-10-24 251 /* Find main memory where is the kernel */
80c4574417ae42 Mike Rapoport 2020-10-13 252 memory_start = memblock_start_of_DRAM();
80c4574417ae42 Mike Rapoport 2020-10-13 253 memory_end = memblock_end_of_DRAM();
001d953ede35df Greentime Hu 2017-10-24 254
001d953ede35df Greentime Hu 2017-10-24 255 if (!memory_end) {
001d953ede35df Greentime Hu 2017-10-24 256 panic("No memory!");
001d953ede35df Greentime Hu 2017-10-24 257 }
001d953ede35df Greentime Hu 2017-10-24 258
001d953ede35df Greentime Hu 2017-10-24 259 ram_start_pfn = PFN_UP(memblock_start_of_DRAM());
001d953ede35df Greentime Hu 2017-10-24 260 /* free_ram_start_pfn is first page after kernel */
001d953ede35df Greentime Hu 2017-10-24 261 free_ram_start_pfn = PFN_UP(__pa(&_end));
001d953ede35df Greentime Hu 2017-10-24 262 max_pfn = PFN_DOWN(memblock_end_of_DRAM());
001d953ede35df Greentime Hu 2017-10-24 263 /* it could update max_pfn */
001d953ede35df Greentime Hu 2017-10-24 264 if (max_pfn - ram_start_pfn <= MAXMEM_PFN)
001d953ede35df Greentime Hu 2017-10-24 265 max_low_pfn = max_pfn;
001d953ede35df Greentime Hu 2017-10-24 266 else {
001d953ede35df Greentime Hu 2017-10-24 267 max_low_pfn = MAXMEM_PFN + ram_start_pfn;
001d953ede35df Greentime Hu 2017-10-24 268 if (!IS_ENABLED(CONFIG_HIGHMEM))
001d953ede35df Greentime Hu 2017-10-24 269 max_pfn = MAXMEM_PFN + ram_start_pfn;
001d953ede35df Greentime Hu 2017-10-24 270 }
001d953ede35df Greentime Hu 2017-10-24 271 /* high_memory is related with VMALLOC */
001d953ede35df Greentime Hu 2017-10-24 272 high_memory = (void *)__va(max_low_pfn * PAGE_SIZE);
001d953ede35df Greentime Hu 2017-10-24 273 min_low_pfn = free_ram_start_pfn;
001d953ede35df Greentime Hu 2017-10-24 274
001d953ede35df Greentime Hu 2017-10-24 275 /*
001d953ede35df Greentime Hu 2017-10-24 276 * initialize the boot-time allocator (with low memory only).
001d953ede35df Greentime Hu 2017-10-24 277 *
001d953ede35df Greentime Hu 2017-10-24 278 * This makes the memory from the end of the kernel to the end of
001d953ede35df Greentime Hu 2017-10-24 279 * RAM usable.
001d953ede35df Greentime Hu 2017-10-24 280 */
001d953ede35df Greentime Hu 2017-10-24 281 memblock_set_bottom_up(true);
001d953ede35df Greentime Hu 2017-10-24 282 memblock_reserve(PFN_PHYS(ram_start_pfn), PFN_PHYS(free_ram_start_pfn - ram_start_pfn));
001d953ede35df Greentime Hu 2017-10-24 283
001d953ede35df Greentime Hu 2017-10-24 284 early_init_fdt_reserve_self();
001d953ede35df Greentime Hu 2017-10-24 285 early_init_fdt_scan_reserved_mem();
001d953ede35df Greentime Hu 2017-10-24 286
001d953ede35df Greentime Hu 2017-10-24 287 memblock_dump_all();
001d953ede35df Greentime Hu 2017-10-24 288 }
001d953ede35df Greentime Hu 2017-10-24 289

:::::: The code at line 247 was first introduced by commit
:::::: 001d953ede35dfb135e636af4b41d5dd20a09471 nds32: Kernel booting and initialization

:::::: TO: Greentime Hu <greentime@xxxxxxxxxxxxx>
:::::: CC: Greentime Hu <greentime@xxxxxxxxxxxxx>

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