All of lore.kernel.org
 help / color / mirror / Atom feed
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: Mon, 11 Oct 2021 17:08:09 +0800	[thread overview]
Message-ID: <202110111756.F0qBWSsf-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 7014 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: um-x86_64_defconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        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
        make W=1 ARCH=um SUBARCH=x86_64

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 >>):

   cc1: warning: arch/um/include/uapi: No such file or directory [-Wmissing-include-dirs]
   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

770fe30a46a12b Kay Sievers       2011-07-31  2314  
73285082745045 Ken Chen          2007-05-08  2315  static int __init loop_init(void)
73285082745045 Ken Chen          2007-05-08  2316  {
a47653fc2643cf Ken Chen          2007-06-08  2317  	int i, nr;
a47653fc2643cf Ken Chen          2007-06-08 @2318  	unsigned long range;
34dd82afd27da2 Kay Sievers       2011-07-31  2319  	struct loop_device *lo;
770fe30a46a12b Kay Sievers       2011-07-31  2320  	int err;
a47653fc2643cf Ken Chen          2007-06-08  2321  
476a4813cfddf7 Laurent Vivier    2008-03-26  2322  	part_shift = 0;
ac04fee0b5c55b Namhyung Kim      2011-05-27  2323  	if (max_part > 0) {
476a4813cfddf7 Laurent Vivier    2008-03-26  2324  		part_shift = fls(max_part);
476a4813cfddf7 Laurent Vivier    2008-03-26  2325  
ac04fee0b5c55b Namhyung Kim      2011-05-27  2326  		/*
ac04fee0b5c55b Namhyung Kim      2011-05-27  2327  		 * Adjust max_part according to part_shift as it is exported
ac04fee0b5c55b Namhyung Kim      2011-05-27  2328  		 * to user space so that user can decide correct minor number
ac04fee0b5c55b Namhyung Kim      2011-05-27  2329  		 * if [s]he want to create more devices.
ac04fee0b5c55b Namhyung Kim      2011-05-27  2330  		 *
ac04fee0b5c55b Namhyung Kim      2011-05-27  2331  		 * Note that -1 is required because partition 0 is reserved
ac04fee0b5c55b Namhyung Kim      2011-05-27  2332  		 * for the whole disk.
ac04fee0b5c55b Namhyung Kim      2011-05-27  2333  		 */
ac04fee0b5c55b Namhyung Kim      2011-05-27  2334  		max_part = (1UL << part_shift) - 1;
ac04fee0b5c55b Namhyung Kim      2011-05-27  2335  	}
ac04fee0b5c55b Namhyung Kim      2011-05-27  2336  
b1a6650406875b Guo Chao          2013-02-21  2337  	if ((1UL << part_shift) > DISK_MAX_PARTS) {
b1a6650406875b Guo Chao          2013-02-21  2338  		err = -EINVAL;
a8c1d064d3e80a Anton Volkov      2017-08-07  2339  		goto err_out;
b1a6650406875b Guo Chao          2013-02-21  2340  	}
78f4bb367fd147 Namhyung Kim      2011-05-24  2341  
b1a6650406875b Guo Chao          2013-02-21  2342  	if (max_loop > 1UL << (MINORBITS - part_shift)) {
b1a6650406875b Guo Chao          2013-02-21  2343  		err = -EINVAL;
a8c1d064d3e80a Anton Volkov      2017-08-07  2344  		goto err_out;
b1a6650406875b Guo Chao          2013-02-21  2345  	}
73285082745045 Ken Chen          2007-05-08  2346  
d134b00b9acca3 Kay Sievers       2011-07-31  2347  	/*
d134b00b9acca3 Kay Sievers       2011-07-31  2348  	 * If max_loop is specified, create that many devices upfront.
d134b00b9acca3 Kay Sievers       2011-07-31  2349  	 * This also becomes a hard limit. If max_loop is not specified,
d134b00b9acca3 Kay Sievers       2011-07-31  2350  	 * create CONFIG_BLK_DEV_LOOP_MIN_COUNT loop devices at module
d134b00b9acca3 Kay Sievers       2011-07-31  2351  	 * init time. Loop devices can be requested on-demand with the
d134b00b9acca3 Kay Sievers       2011-07-31  2352  	 * /dev/loop-control interface, or be instantiated by accessing
d134b00b9acca3 Kay Sievers       2011-07-31  2353  	 * a 'dead' device node.
d134b00b9acca3 Kay Sievers       2011-07-31  2354  	 */
73285082745045 Ken Chen          2007-05-08  2355  	if (max_loop) {
a47653fc2643cf Ken Chen          2007-06-08  2356  		nr = max_loop;
a1c15c59feee36 Namhyung Kim      2011-05-24  2357  		range = max_loop << part_shift;
a47653fc2643cf Ken Chen          2007-06-08  2358  	} else {
d134b00b9acca3 Kay Sievers       2011-07-31  2359  		nr = CONFIG_BLK_DEV_LOOP_MIN_COUNT;
a1c15c59feee36 Namhyung Kim      2011-05-24  2360  		range = 1UL << MINORBITS;
a47653fc2643cf Ken Chen          2007-06-08  2361  	}
a47653fc2643cf Ken Chen          2007-06-08  2362  
a8c1d064d3e80a Anton Volkov      2017-08-07  2363  	err = misc_register(&loop_misc);
a8c1d064d3e80a Anton Volkov      2017-08-07  2364  	if (err < 0)
a8c1d064d3e80a Anton Volkov      2017-08-07  2365  		goto err_out;
a8c1d064d3e80a Anton Volkov      2017-08-07  2366  
a8c1d064d3e80a Anton Volkov      2017-08-07  2367  
cec81ebfb62261 Christoph Hellwig 2020-08-23  2368  	if (__register_blkdev(LOOP_MAJOR, "loop", loop_probe)) {
b1a6650406875b Guo Chao          2013-02-21  2369  		err = -EIO;
b1a6650406875b Guo Chao          2013-02-21  2370  		goto misc_out;
b1a6650406875b Guo Chao          2013-02-21  2371  	}
73285082745045 Ken Chen          2007-05-08  2372  
d134b00b9acca3 Kay Sievers       2011-07-31  2373  	/* pre-create number of devices given by config or max_loop */
0a42e99b58a208 Jan Kara          2018-11-08  2374  	mutex_lock(&loop_ctl_mutex);
34dd82afd27da2 Kay Sievers       2011-07-31  2375  	for (i = 0; i < nr; i++)
34dd82afd27da2 Kay Sievers       2011-07-31  2376  		loop_add(&lo, i);
0a42e99b58a208 Jan Kara          2018-11-08  2377  	mutex_unlock(&loop_ctl_mutex);
34dd82afd27da2 Kay Sievers       2011-07-31  2378  
73285082745045 Ken Chen          2007-05-08  2379  	printk(KERN_INFO "loop: module loaded\n");
^1da177e4c3f41 Linus Torvalds    2005-04-16  2380  	return 0;
b1a6650406875b Guo Chao          2013-02-21  2381  
b1a6650406875b Guo Chao          2013-02-21  2382  misc_out:
b1a6650406875b Guo Chao          2013-02-21  2383  	misc_deregister(&loop_misc);
a8c1d064d3e80a Anton Volkov      2017-08-07  2384  err_out:
b1a6650406875b Guo Chao          2013-02-21  2385  	return err;
34dd82afd27da2 Kay Sievers       2011-07-31  2386  }
a47653fc2643cf 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: 8548 bytes --]

             reply	other threads:[~2021-10-11  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11  9:08 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-10-29 18:18 [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=202110111756.F0qBWSsf-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.