Hi David,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on driver-core/driver-core-testing next-20210125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url:
https://github.com/0day-ci/linux/commits/David-Hildenbrand/drivers-base-m...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
2ab38c17aac10bf55ab3efde4c4db3893d8691d2
config: x86_64-randconfig-s031-20210201 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-215-g0fb77bb6-dirty
#
https://github.com/0day-ci/linux/commit/614341d29c44f8965a604b9fd5d09eb0b...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
David-Hildenbrand/drivers-base-memory-clarify-some-memory-block-properties/20210201-185331
git checkout 614341d29c44f8965a604b9fd5d09eb0b652864c
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/base/memory.c: In function 'init_memory_block':
> drivers/base/memory.c:573:16: warning: variable
'start_pfn' set but not used [-Wunused-but-set-variable]
573 |
unsigned long start_pfn;
| ^~~~~~~~~
vim +/start_pfn +573 drivers/base/memory.c
96b2c0fc8e74a6 Nathan Fontenot 2013-06-04 569
40ba2cde77e764 Wei Yang 2020-06-23 570 static int init_memory_block(unsigned
long block_id, unsigned long state)
e4619c857d1d76 Nathan Fontenot 2010-10-19 571 {
0c2c99b1b8ab5d Nathan Fontenot 2011-01-20 572 struct memory_block *mem;
e4619c857d1d76 Nathan Fontenot 2010-10-19 @573 unsigned long start_pfn;
e4619c857d1d76 Nathan Fontenot 2010-10-19 574 int ret = 0;
e4619c857d1d76 Nathan Fontenot 2010-10-19 575
dd625285910d3c David Hildenbrand 2019-07-18 576 mem =
find_memory_block_by_id(block_id);
db051a0dac13db David Hildenbrand 2019-07-18 577 if (mem) {
db051a0dac13db David Hildenbrand 2019-07-18 578 put_device(&mem->dev);
db051a0dac13db David Hildenbrand 2019-07-18 579 return -EEXIST;
db051a0dac13db David Hildenbrand 2019-07-18 580 }
0c2c99b1b8ab5d Nathan Fontenot 2011-01-20 581 mem = kzalloc(sizeof(*mem),
GFP_KERNEL);
e4619c857d1d76 Nathan Fontenot 2010-10-19 582 if (!mem)
e4619c857d1d76 Nathan Fontenot 2010-10-19 583 return -ENOMEM;
e4619c857d1d76 Nathan Fontenot 2010-10-19 584
1811582587c43b David Hildenbrand 2019-07-18 585 mem->start_section_nr = block_id *
sections_per_block;
e4619c857d1d76 Nathan Fontenot 2010-10-19 586 mem->state = state;
d33601644cd3b0 Nathan Fontenot 2011-01-20 587 start_pfn =
section_nr_to_pfn(mem->start_section_nr);
d84f2f5a755208 David Hildenbrand 2019-09-23 588 mem->nid = NUMA_NO_NODE;
e4619c857d1d76 Nathan Fontenot 2010-10-19 589
0c2c99b1b8ab5d Nathan Fontenot 2011-01-20 590 ret = register_memory(mem);
0c2c99b1b8ab5d Nathan Fontenot 2011-01-20 591
0c2c99b1b8ab5d Nathan Fontenot 2011-01-20 592 return ret;
0c2c99b1b8ab5d Nathan Fontenot 2011-01-20 593 }
0c2c99b1b8ab5d Nathan Fontenot 2011-01-20 594
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org