[android-common:main-16k-gs-shusky-5.15 35/35] drivers/cma/mm/mem_phys_layout.c:151:9: warning: ISO C90 forbids mixed declarations and code
kernel test robot <[email protected]> Wed, 29 Jul 2026 01:59:01 +0800
| Newsgroups | dev.linux.lists.oe-kbuild-all |
|---|---|
| Message-ID | <[email protected]> |
tree: https://android.googlesource.com/kernel/common main-16k-gs-shusky-5.15 head: d0ed0375a65ca817f907805e163e103822348f02 commit: b6f7366938c4d377ba5179501f82eea795a17bc2 [35/35] ANDROID: mm: Calculate struct page address given the PFN and vemmap config: x86_64-randconfig-161 (https://download.01.org/0day-ci/archive/20260729/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 smatch: v0.5.0-9187-g5189e3fb reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260729/[email protected]/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 <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ All warnings (new ones prefixed by >>): drivers/cma/mm/mem_phys_layout.c: In function 'print_page_info': >> drivers/cma/mm/mem_phys_layout.c:151:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 151 | unsigned long last_pfn = pfn - 1; | ^~~~~~~~ vim +151 drivers/cma/mm/mem_phys_layout.c 116 117 static void print_page_info(void) 118 { 119 unsigned long pfn; 120 int valid = 0; 121 int invalid = 0; 122 unsigned long num_physpages = get_num_physpages(); 123 124 // Start address as per DTS memory@40000000. The first valid PFN represents 125 // this page frame. 126 phys_addr_t start_addr = memblock_start_of_DRAM(); 127 unsigned long start_pfn = PHYS_PFN(start_addr); 128 129 for (pfn = start_pfn; pfn < (start_pfn + num_physpages); pfn++) { 130 if (pfn_valid(pfn)) 131 valid++; 132 else 133 invalid++; 134 } 135 136 pr_info("get_num_physpages() = %lu", num_physpages); 137 pr_info("valid %d, invalid %d, physpages %lu", valid, invalid, num_physpages); 138 139 pr_info("Start PFN"); 140 print_mem_model(start_pfn); 141 pr_info("End PFN"); 142 print_mem_model(pfn - 1); 143 144 #ifdef CONFIG_SPARSEMEM_VMEMMAP 145 // CALCULATE STRUCT *P GIVEN THE PFN and vmemmap address 146 pr_info("First struct page starts at: vmemmap [mem %#010Lx]\n", 147 (unsigned long long)vmemmap); 148 149 // How to calculate Physical Address of the Page Frame and the struct page 150 // given the PFN. > 151 unsigned long last_pfn = pfn - 1; 152 struct page *page = vmemmap + last_pfn; 153 phys_addr_t addr = last_pfn << PAGE_SHIFT; 154 155 pr_info("Calculating physical address given vmemmap and PFN %10llu == %#010Lx", 156 (u64)last_pfn, (u64)last_pfn); 157 pr_info(" PFN: %10llu == %#010Lx struct page[mem %#010Lx], PHYS[mem %#010Lx]", 158 (u64)last_pfn, 159 (u64)last_pfn, 160 (u64)page, 161 addr); 162 #endif 163 } 164 static int __init mem_phys_layout_init(void) 165 { 166 print_ram_info(); 167 print_node_data(); 168 print_pfn_start_address(); 169 print_pageblock_info(); 170 print_page_info(); 171 172 return 0; 173 } 174 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki