From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [hch-block:gendisk-lookup 10/18] drivers/block/loop.c:2318:16: warning: variable 'range' set but not used
Date: Fri, 30 Oct 2020 02:18:00 +0800 [thread overview]
Message-ID: <202010300245.e3pWVBQb-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 8212 bytes --]
tree: git://git.infradead.org/users/hch/block.git gendisk-lookup
head: 2aa8840c446b029b28c2bb8ffff9cd0fc9e8ee79
commit: cec81ebfb622616f62b9d6c5633e05ad9de57f04 [10/18] loop: use __register_blkdev to allocate devices on demand
config: h8300-randconfig-r025-20201029 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add hch-block git://git.infradead.org/users/hch/block.git
git fetch --no-tags hch-block gendisk-lookup
git checkout cec81ebfb622616f62b9d6c5633e05ad9de57f04
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/block/loop.c:52:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/asm-generic/page.h:93:50: warning: ordered comparison of pointer with null pointer [-Wextra]
93 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
drivers/block/loop.c: In function 'loop_init':
>> drivers/block/loop.c:2318:16: warning: variable 'range' set but not used [-Wunused-but-set-variable]
2318 | unsigned long range;
| ^~~~~
vim +/range +2318 drivers/block/loop.c
770fe30a46a12b6 Kay Sievers 2011-07-31 2314
73285082745045b Ken Chen 2007-05-08 2315 static int __init loop_init(void)
73285082745045b Ken Chen 2007-05-08 2316 {
a47653fc2643cf6 Ken Chen 2007-06-08 2317 int i, nr;
a47653fc2643cf6 Ken Chen 2007-06-08 @2318 unsigned long range;
34dd82afd27da25 Kay Sievers 2011-07-31 2319 struct loop_device *lo;
770fe30a46a12b6 Kay Sievers 2011-07-31 2320 int err;
a47653fc2643cf6 Ken Chen 2007-06-08 2321
476a4813cfddf7c Laurent Vivier 2008-03-26 2322 part_shift = 0;
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2323 if (max_part > 0) {
476a4813cfddf7c Laurent Vivier 2008-03-26 2324 part_shift = fls(max_part);
476a4813cfddf7c Laurent Vivier 2008-03-26 2325
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2326 /*
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2327 * Adjust max_part according to part_shift as it is exported
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2328 * to user space so that user can decide correct minor number
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2329 * if [s]he want to create more devices.
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2330 *
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2331 * Note that -1 is required because partition 0 is reserved
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2332 * for the whole disk.
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2333 */
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2334 max_part = (1UL << part_shift) - 1;
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2335 }
ac04fee0b5c55bb Namhyung Kim 2011-05-27 2336
b1a6650406875b9 Guo Chao 2013-02-21 2337 if ((1UL << part_shift) > DISK_MAX_PARTS) {
b1a6650406875b9 Guo Chao 2013-02-21 2338 err = -EINVAL;
a8c1d064d3e80aa Anton Volkov 2017-08-07 2339 goto err_out;
b1a6650406875b9 Guo Chao 2013-02-21 2340 }
78f4bb367fd147a Namhyung Kim 2011-05-24 2341
b1a6650406875b9 Guo Chao 2013-02-21 2342 if (max_loop > 1UL << (MINORBITS - part_shift)) {
b1a6650406875b9 Guo Chao 2013-02-21 2343 err = -EINVAL;
a8c1d064d3e80aa Anton Volkov 2017-08-07 2344 goto err_out;
b1a6650406875b9 Guo Chao 2013-02-21 2345 }
73285082745045b Ken Chen 2007-05-08 2346
d134b00b9acca3f Kay Sievers 2011-07-31 2347 /*
d134b00b9acca3f Kay Sievers 2011-07-31 2348 * If max_loop is specified, create that many devices upfront.
d134b00b9acca3f Kay Sievers 2011-07-31 2349 * This also becomes a hard limit. If max_loop is not specified,
d134b00b9acca3f Kay Sievers 2011-07-31 2350 * create CONFIG_BLK_DEV_LOOP_MIN_COUNT loop devices at module
d134b00b9acca3f Kay Sievers 2011-07-31 2351 * init time. Loop devices can be requested on-demand with the
d134b00b9acca3f Kay Sievers 2011-07-31 2352 * /dev/loop-control interface, or be instantiated by accessing
d134b00b9acca3f Kay Sievers 2011-07-31 2353 * a 'dead' device node.
d134b00b9acca3f Kay Sievers 2011-07-31 2354 */
73285082745045b Ken Chen 2007-05-08 2355 if (max_loop) {
a47653fc2643cf6 Ken Chen 2007-06-08 2356 nr = max_loop;
a1c15c59feee362 Namhyung Kim 2011-05-24 2357 range = max_loop << part_shift;
a47653fc2643cf6 Ken Chen 2007-06-08 2358 } else {
d134b00b9acca3f Kay Sievers 2011-07-31 2359 nr = CONFIG_BLK_DEV_LOOP_MIN_COUNT;
a1c15c59feee362 Namhyung Kim 2011-05-24 2360 range = 1UL << MINORBITS;
a47653fc2643cf6 Ken Chen 2007-06-08 2361 }
a47653fc2643cf6 Ken Chen 2007-06-08 2362
a8c1d064d3e80aa Anton Volkov 2017-08-07 2363 err = misc_register(&loop_misc);
a8c1d064d3e80aa Anton Volkov 2017-08-07 2364 if (err < 0)
a8c1d064d3e80aa Anton Volkov 2017-08-07 2365 goto err_out;
a8c1d064d3e80aa Anton Volkov 2017-08-07 2366
a8c1d064d3e80aa Anton Volkov 2017-08-07 2367
cec81ebfb622616 Christoph Hellwig 2020-08-23 2368 if (__register_blkdev(LOOP_MAJOR, "loop", loop_probe)) {
b1a6650406875b9 Guo Chao 2013-02-21 2369 err = -EIO;
b1a6650406875b9 Guo Chao 2013-02-21 2370 goto misc_out;
b1a6650406875b9 Guo Chao 2013-02-21 2371 }
73285082745045b Ken Chen 2007-05-08 2372
d134b00b9acca3f Kay Sievers 2011-07-31 2373 /* pre-create number of devices given by config or max_loop */
0a42e99b58a2088 Jan Kara 2018-11-08 2374 mutex_lock(&loop_ctl_mutex);
34dd82afd27da25 Kay Sievers 2011-07-31 2375 for (i = 0; i < nr; i++)
34dd82afd27da25 Kay Sievers 2011-07-31 2376 loop_add(&lo, i);
0a42e99b58a2088 Jan Kara 2018-11-08 2377 mutex_unlock(&loop_ctl_mutex);
34dd82afd27da25 Kay Sievers 2011-07-31 2378
73285082745045b Ken Chen 2007-05-08 2379 printk(KERN_INFO "loop: module loaded\n");
^1da177e4c3f415 Linus Torvalds 2005-04-16 2380 return 0;
b1a6650406875b9 Guo Chao 2013-02-21 2381
b1a6650406875b9 Guo Chao 2013-02-21 2382 misc_out:
b1a6650406875b9 Guo Chao 2013-02-21 2383 misc_deregister(&loop_misc);
a8c1d064d3e80aa Anton Volkov 2017-08-07 2384 err_out:
b1a6650406875b9 Guo Chao 2013-02-21 2385 return err;
34dd82afd27da25 Kay Sievers 2011-07-31 2386 }
a47653fc2643cf6 Ken Chen 2007-06-08 2387
:::::: The code@line 2318 was first introduced by commit
:::::: a47653fc2643cf61bcabba8c9ff5c45517c089ba loop: preallocate eight loop devices
:::::: TO: Ken Chen <kenchen@google.com>
:::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26624 bytes --]
next reply other threads:[~2020-10-29 18:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 18:18 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-10-11 9:08 [hch-block:gendisk-lookup 10/18] drivers/block/loop.c:2318:16: warning: variable 'range' set but not used kernel test robot
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=202010300245.e3pWVBQb-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/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.