All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: cros-kernel-buildreports@googlegroups.com
Cc: oe-kbuild-all@lists.linux.dev
Subject: [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
Date: Wed, 29 Jul 2026 01:59:01 +0800	[thread overview]
Message-ID: <202607290034.iLGhlM4U-lkp@intel.com> (raw)

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/202607290034.iLGhlM4U-lkp@intel.com/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/202607290034.iLGhlM4U-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607290034.iLGhlM4U-lkp@intel.com/

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

                 reply	other threads:[~2026-07-28 17:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202607290034.iLGhlM4U-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=cros-kernel-buildreports@googlegroups.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.