[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202110190206.yD17uQNO-lkp@intel.com>
Date: Tue, 19 Oct 2021 02:40:25 +0800
From: kernel test robot <lkp@...el.com>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: [mcgrof-next:20211011-for-axboe-add-disk-error-handling 24/24]
drivers/md/md.c:5705:2: warning: ignoring return value of function declared
with 'warn_unused_result' attribute
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20211011-for-axboe-add-disk-error-handling
head: 53099761729ca16d3bb36db8a8cc526f4eb08f28
commit: 53099761729ca16d3bb36db8a8cc526f4eb08f28 [24/24] block: add __must_check for *add_disk*() callers
config: hexagon-randconfig-r041-20211019 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d245f2e8597bfb52c34810a328d42b990e4af1a4)
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
# https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/commit/?id=53099761729ca16d3bb36db8a8cc526f4eb08f28
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20211011-for-axboe-add-disk-error-handling
git checkout 53099761729ca16d3bb36db8a8cc526f4eb08f28
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> drivers/md/md.c:5705:2: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
add_disk(disk);
^~~~~~~~ ~~~~
1 warning generated.
vim +/warn_unused_result +5705 drivers/md/md.c
a415c0f1062791 NeilBrown 2017-06-05 5620
efeb53c0e57213 NeilBrown 2009-01-09 5621 static int md_alloc(dev_t dev, char *name)
^1da177e4c3f41 Linus Torvalds 2005-04-16 5622 {
039b7225e6e987 NeilBrown 2017-04-12 5623 /*
039b7225e6e987 NeilBrown 2017-04-12 5624 * If dev is zero, name is the name of a device to allocate with
039b7225e6e987 NeilBrown 2017-04-12 5625 * an arbitrary minor number. It will be "md_???"
039b7225e6e987 NeilBrown 2017-04-12 5626 * If dev is non-zero it must be a device number with a MAJOR of
039b7225e6e987 NeilBrown 2017-04-12 5627 * MD_MAJOR or mdp_major. In this case, if "name" is NULL, then
039b7225e6e987 NeilBrown 2017-04-12 5628 * the device is being created by opening a node in /dev.
039b7225e6e987 NeilBrown 2017-04-12 5629 * If "name" is not NULL, the device is being created by
039b7225e6e987 NeilBrown 2017-04-12 5630 * writing to /sys/module/md_mod/parameters/new_array.
039b7225e6e987 NeilBrown 2017-04-12 5631 */
48c9c27b8bcd2a Arjan van de Ven 2006-03-27 5632 static DEFINE_MUTEX(disks_mutex);
0d809b3837a0be Christoph Hellwig 2021-04-12 5633 struct mddev *mddev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5634 struct gendisk *disk;
efeb53c0e57213 NeilBrown 2009-01-09 5635 int partitioned;
efeb53c0e57213 NeilBrown 2009-01-09 5636 int shift;
efeb53c0e57213 NeilBrown 2009-01-09 5637 int unit;
3830c62fef49f8 Greg Kroah-Hartman 2007-12-17 5638 int error ;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5639
0d809b3837a0be Christoph Hellwig 2021-04-12 5640 /*
0d809b3837a0be Christoph Hellwig 2021-04-12 5641 * Wait for any previous instance of this device to be completely
0d809b3837a0be Christoph Hellwig 2021-04-12 5642 * removed (mddev_delayed_delete).
d3374825ce57ba NeilBrown 2009-01-09 5643 */
e804ac780e2f01 Tejun Heo 2010-10-15 5644 flush_workqueue(md_misc_wq);
d3374825ce57ba NeilBrown 2009-01-09 5645
48c9c27b8bcd2a Arjan van de Ven 2006-03-27 5646 mutex_lock(&disks_mutex);
0d809b3837a0be Christoph Hellwig 2021-04-12 5647 mddev = mddev_alloc(dev);
0d809b3837a0be Christoph Hellwig 2021-04-12 5648 if (IS_ERR(mddev)) {
0d809b3837a0be Christoph Hellwig 2021-04-12 5649 mutex_unlock(&disks_mutex);
0d809b3837a0be Christoph Hellwig 2021-04-12 5650 return PTR_ERR(mddev);
0d809b3837a0be Christoph Hellwig 2021-04-12 5651 }
0d809b3837a0be Christoph Hellwig 2021-04-12 5652
0d809b3837a0be Christoph Hellwig 2021-04-12 5653 partitioned = (MAJOR(mddev->unit) != MD_MAJOR);
0d809b3837a0be Christoph Hellwig 2021-04-12 5654 shift = partitioned ? MdpMinorShift : 0;
0d809b3837a0be Christoph Hellwig 2021-04-12 5655 unit = MINOR(mddev->unit) >> shift;
efeb53c0e57213 NeilBrown 2009-01-09 5656
039b7225e6e987 NeilBrown 2017-04-12 5657 if (name && !dev) {
efeb53c0e57213 NeilBrown 2009-01-09 5658 /* Need to ensure that 'name' is not a duplicate.
efeb53c0e57213 NeilBrown 2009-01-09 5659 */
fd01b88c75a718 NeilBrown 2011-10-11 5660 struct mddev *mddev2;
efeb53c0e57213 NeilBrown 2009-01-09 5661 spin_lock(&all_mddevs_lock);
efeb53c0e57213 NeilBrown 2009-01-09 5662
efeb53c0e57213 NeilBrown 2009-01-09 5663 list_for_each_entry(mddev2, &all_mddevs, all_mddevs)
efeb53c0e57213 NeilBrown 2009-01-09 5664 if (mddev2->gendisk &&
efeb53c0e57213 NeilBrown 2009-01-09 5665 strcmp(mddev2->gendisk->disk_name, name) == 0) {
efeb53c0e57213 NeilBrown 2009-01-09 5666 spin_unlock(&all_mddevs_lock);
0d809b3837a0be Christoph Hellwig 2021-04-12 5667 error = -EEXIST;
0909dc448c98ed NeilBrown 2009-07-01 5668 goto abort;
efeb53c0e57213 NeilBrown 2009-01-09 5669 }
efeb53c0e57213 NeilBrown 2009-01-09 5670 spin_unlock(&all_mddevs_lock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 5671 }
039b7225e6e987 NeilBrown 2017-04-12 5672 if (name && dev)
039b7225e6e987 NeilBrown 2017-04-12 5673 /*
039b7225e6e987 NeilBrown 2017-04-12 5674 * Creating /dev/mdNNN via "newarray", so adjust hold_active.
039b7225e6e987 NeilBrown 2017-04-12 5675 */
039b7225e6e987 NeilBrown 2017-04-12 5676 mddev->hold_active = UNTIL_STOP;
8b76539823d715 NeilBrown 2009-01-09 5677
0909dc448c98ed NeilBrown 2009-07-01 5678 error = -ENOMEM;
0f1d2e0643c544 Christoph Hellwig 2021-05-21 5679 disk = blk_alloc_disk(NUMA_NO_NODE);
0f1d2e0643c544 Christoph Hellwig 2021-05-21 5680 if (!disk)
0909dc448c98ed NeilBrown 2009-07-01 5681 goto abort;
409c57f3801701 NeilBrown 2009-03-31 5682
efeb53c0e57213 NeilBrown 2009-01-09 5683 disk->major = MAJOR(mddev->unit);
^1da177e4c3f41 Linus Torvalds 2005-04-16 5684 disk->first_minor = unit << shift;
0f1d2e0643c544 Christoph Hellwig 2021-05-21 5685 disk->minors = 1 << shift;
efeb53c0e57213 NeilBrown 2009-01-09 5686 if (name)
efeb53c0e57213 NeilBrown 2009-01-09 5687 strcpy(disk->disk_name, name);
efeb53c0e57213 NeilBrown 2009-01-09 5688 else if (partitioned)
^1da177e4c3f41 Linus Torvalds 2005-04-16 5689 sprintf(disk->disk_name, "md_d%d", unit);
ce7b0f46bbf4bf Greg Kroah-Hartman 2005-06-20 5690 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 5691 sprintf(disk->disk_name, "md%d", unit);
^1da177e4c3f41 Linus Torvalds 2005-04-16 5692 disk->fops = &md_fops;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5693 disk->private_data = mddev;
0f1d2e0643c544 Christoph Hellwig 2021-05-21 5694
0f1d2e0643c544 Christoph Hellwig 2021-05-21 5695 mddev->queue = disk->queue;
0f1d2e0643c544 Christoph Hellwig 2021-05-21 5696 blk_set_stacking_limits(&mddev->queue->limits);
56883a7ec85f5b Jens Axboe 2016-03-30 5697 blk_queue_write_cache(mddev->queue, true, true);
92850bbd712287 NeilBrown 2008-10-21 5698 /* Allow extended partitions. This makes the
d3374825ce57ba NeilBrown 2009-01-09 5699 * 'mdp' device redundant, but we can't really
92850bbd712287 NeilBrown 2008-10-21 5700 * remove it now.
92850bbd712287 NeilBrown 2008-10-21 5701 */
92850bbd712287 NeilBrown 2008-10-21 5702 disk->flags |= GENHD_FL_EXT_DEVT;
a564e23f0f9975 Christoph Hellwig 2020-07-08 5703 disk->events |= DISK_EVENT_MEDIA_CHANGE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5704 mddev->gendisk = disk;
b0140891a8cea3 NeilBrown 2011-05-10 @5705 add_disk(disk);
b0140891a8cea3 NeilBrown 2011-05-10 5706
28dec870aaf704 Kent Overstreet 2018-06-07 5707 error = kobject_add(&mddev->kobj, &disk_to_dev(disk)->kobj, "%s", "md");
0909dc448c98ed NeilBrown 2009-07-01 5708 if (error) {
0909dc448c98ed NeilBrown 2009-07-01 5709 /* This isn't possible, but as kobject_init_and_add is marked
0909dc448c98ed NeilBrown 2009-07-01 5710 * __must_check, we must do something with the result
0909dc448c98ed NeilBrown 2009-07-01 5711 */
9d48739ef19aa8 NeilBrown 2016-11-02 5712 pr_debug("md: cannot register %s/md - name in use\n",
5e55e2f5fc95b3 NeilBrown 2007-03-26 5713 disk->disk_name);
0909dc448c98ed NeilBrown 2009-07-01 5714 error = 0;
0909dc448c98ed NeilBrown 2009-07-01 5715 }
00bcb4ac7ee7e5 NeilBrown 2010-06-01 5716 if (mddev->kobj.sd &&
00bcb4ac7ee7e5 NeilBrown 2010-06-01 5717 sysfs_create_group(&mddev->kobj, &md_bitmap_group))
9d48739ef19aa8 NeilBrown 2016-11-02 5718 pr_debug("pointless warning\n");
0909dc448c98ed NeilBrown 2009-07-01 5719 abort:
0909dc448c98ed NeilBrown 2009-07-01 5720 mutex_unlock(&disks_mutex);
00bcb4ac7ee7e5 NeilBrown 2010-06-01 5721 if (!error && mddev->kobj.sd) {
3830c62fef49f8 Greg Kroah-Hartman 2007-12-17 5722 kobject_uevent(&mddev->kobj, KOBJ_ADD);
00bcb4ac7ee7e5 NeilBrown 2010-06-01 5723 mddev->sysfs_state = sysfs_get_dirent_safe(mddev->kobj.sd, "array_state");
e1a86dbbbd6a77 Junxiao Bi 2020-07-14 5724 mddev->sysfs_level = sysfs_get_dirent_safe(mddev->kobj.sd, "level");
b62b75905d571c NeilBrown 2008-10-21 5725 }
d3374825ce57ba NeilBrown 2009-01-09 5726 mddev_put(mddev);
0909dc448c98ed NeilBrown 2009-07-01 5727 return error;
efeb53c0e57213 NeilBrown 2009-01-09 5728 }
efeb53c0e57213 NeilBrown 2009-01-09 5729
:::::: The code at line 5705 was first introduced by commit
:::::: b0140891a8cea36469f58d23859e599b1122bd37 md: Fix race when creating a new md device.
:::::: TO: NeilBrown <neilb@...e.de>
:::::: CC: NeilBrown <neilb@...e.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (29409 bytes)
Powered by blists - more mailing lists