[mcgrof-next:20210708-block-fixes-v2 88/89] drivers/md/dm.c:1795:2: warning: ignoring return value of function declared with 'warn_unused_result' attribute

From: kernel test robot
Date: Thu Jul 15 2021 - 10:18:57 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20210708-block-fixes-v2
head: db0174e39de7dc941f158ce53ee3af95b1635b62
commit: 5e5cb4297124917e4c9480cef81930ecb092fbb6 [88/89] block: add __must_check for *add_disk*() callers
config: powerpc-randconfig-r005-20210715 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 0e49c54a8cbd3e779e5526a5888c683c01cc3c50)
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
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/commit/?id=5e5cb4297124917e4c9480cef81930ecb092fbb6
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20210708-block-fixes-v2
git checkout 5e5cb4297124917e4c9480cef81930ecb092fbb6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/md/dm.c:1795:2: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
add_disk_no_queue_reg(md->disk);
^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
1 warning generated.


vim +/warn_unused_result +1795 drivers/md/dm.c

0f20972f7bf692 Mike Snitzer 2015-04-28 1715
^1da177e4c3f41 Linus Torvalds 2005-04-16 1716 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 1717 * Allocate and initialise a blank device with a given minor.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1718 */
2b06cfff12f0f8 Alasdair G Kergon 2006-06-26 1719 static struct mapped_device *alloc_dev(int minor)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1720 {
115485e83f497f Mike Snitzer 2016-02-22 1721 int r, numa_node_id = dm_get_numa_node();
115485e83f497f Mike Snitzer 2016-02-22 1722 struct mapped_device *md;
ba61fdd17d73dd Jeff Mahoney 2006-06-26 1723 void *old_md;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1724
856eb0916d181d Mikulas Patocka 2017-10-31 1725 md = kvzalloc_node(sizeof(*md), GFP_KERNEL, numa_node_id);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1726 if (!md) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1727 DMWARN("unable to allocate device, out of memory.");
^1da177e4c3f41 Linus Torvalds 2005-04-16 1728 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1729 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1730
10da4f795f965f Jeff Mahoney 2006-06-26 1731 if (!try_module_get(THIS_MODULE))
6ed7ade89657e7 Milan Broz 2008-02-08 1732 goto bad_module_get;
10da4f795f965f Jeff Mahoney 2006-06-26 1733
^1da177e4c3f41 Linus Torvalds 2005-04-16 1734 /* get a minor number for the dev */
2b06cfff12f0f8 Alasdair G Kergon 2006-06-26 1735 if (minor == DM_ANY_MINOR)
cf13ab8e02d452 Frederik Deweerdt 2008-04-24 1736 r = next_free_minor(&minor);
2b06cfff12f0f8 Alasdair G Kergon 2006-06-26 1737 else
cf13ab8e02d452 Frederik Deweerdt 2008-04-24 1738 r = specific_minor(minor);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1739 if (r < 0)
6ed7ade89657e7 Milan Broz 2008-02-08 1740 goto bad_minor;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1741
83d5e5b0af907d Mikulas Patocka 2013-07-10 1742 r = init_srcu_struct(&md->io_barrier);
83d5e5b0af907d Mikulas Patocka 2013-07-10 1743 if (r < 0)
83d5e5b0af907d Mikulas Patocka 2013-07-10 1744 goto bad_io_barrier;
83d5e5b0af907d Mikulas Patocka 2013-07-10 1745
115485e83f497f Mike Snitzer 2016-02-22 1746 md->numa_node_id = numa_node_id;
591ddcfc4bfad2 Mike Snitzer 2016-01-31 1747 md->init_tio_pdu = false;
a5664dad7e1a27 Mike Snitzer 2010-08-12 1748 md->type = DM_TYPE_NONE;
e61290a4a23c3f Daniel Walker 2008-02-08 1749 mutex_init(&md->suspend_lock);
a5664dad7e1a27 Mike Snitzer 2010-08-12 1750 mutex_init(&md->type_lock);
86f1152b117a40 Benjamin Marzinski 2014-08-13 1751 mutex_init(&md->table_devices_lock);
022c261100e156 Mikulas Patocka 2009-04-02 1752 spin_lock_init(&md->deferred_lock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1753 atomic_set(&md->holders, 1);
5c6bd75d06db51 Alasdair G Kergon 2006-06-26 1754 atomic_set(&md->open_count, 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1755 atomic_set(&md->event_nr, 0);
7a8c3d3b928837 Mike Anderson 2007-10-19 1756 atomic_set(&md->uevent_seq, 0);
7a8c3d3b928837 Mike Anderson 2007-10-19 1757 INIT_LIST_HEAD(&md->uevent_list);
86f1152b117a40 Benjamin Marzinski 2014-08-13 1758 INIT_LIST_HEAD(&md->table_devices);
7a8c3d3b928837 Mike Anderson 2007-10-19 1759 spin_lock_init(&md->uevent_lock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1760
47ace7e012b9f7 Mike Snitzer 2020-01-27 1761 /*
c62b37d96b6eb3 Christoph Hellwig 2020-07-01 1762 * default to bio-based until DM table is loaded and md->type
c62b37d96b6eb3 Christoph Hellwig 2020-07-01 1763 * established. If request-based table is loaded: blk-mq will
c62b37d96b6eb3 Christoph Hellwig 2020-07-01 1764 * override accordingly.
47ace7e012b9f7 Mike Snitzer 2020-01-27 1765 */
74fe6ba9239497 Christoph Hellwig 2021-05-21 1766 md->disk = blk_alloc_disk(md->numa_node_id);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1767 if (!md->disk)
0f20972f7bf692 Mike Snitzer 2015-04-28 1768 goto bad;
74fe6ba9239497 Christoph Hellwig 2021-05-21 1769 md->queue = md->disk->queue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1770
f0b04115368ff3 Jeff Mahoney 2006-06-26 1771 init_waitqueue_head(&md->wait);
53d5914f288b67 Mikulas Patocka 2009-04-02 1772 INIT_WORK(&md->work, dm_wq_work);
f0b04115368ff3 Jeff Mahoney 2006-06-26 1773 init_waitqueue_head(&md->eventq);
2995fa78e423d7 Mikulas Patocka 2014-01-13 1774 init_completion(&md->kobj_holder.completion);
f0b04115368ff3 Jeff Mahoney 2006-06-26 1775
a666e5c05e7c4a Mikulas Patocka 2021-02-10 1776 md->swap_bios = get_swap_bios();
a666e5c05e7c4a Mikulas Patocka 2021-02-10 1777 sema_init(&md->swap_bios_semaphore, md->swap_bios);
a666e5c05e7c4a Mikulas Patocka 2021-02-10 1778 mutex_init(&md->swap_bios_lock);
a666e5c05e7c4a Mikulas Patocka 2021-02-10 1779
^1da177e4c3f41 Linus Torvalds 2005-04-16 1780 md->disk->major = _major;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1781 md->disk->first_minor = minor;
74fe6ba9239497 Christoph Hellwig 2021-05-21 1782 md->disk->minors = 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1783 md->disk->fops = &dm_blk_dops;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1784 md->disk->queue = md->queue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1785 md->disk->private_data = md;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1786 sprintf(md->disk->disk_name, "dm-%d", minor);
f26c5719b2d7b0 Dan Williams 2017-04-12 1787
976431b02c2ef9 Dan Williams 2018-03-29 1788 if (IS_ENABLED(CONFIG_DAX_DRIVER)) {
fefc1d97fa4b5e Pankaj Gupta 2019-07-05 1789 md->dax_dev = alloc_dax(md, md->disk->disk_name,
fefc1d97fa4b5e Pankaj Gupta 2019-07-05 1790 &dm_dax_ops, 0);
4e4ced93794acb Vivek Goyal 2020-04-01 1791 if (IS_ERR(md->dax_dev))
f26c5719b2d7b0 Dan Williams 2017-04-12 1792 goto bad;
976431b02c2ef9 Dan Williams 2018-03-29 1793 }
f26c5719b2d7b0 Dan Williams 2017-04-12 1794
c100ec49fdd222 Mike Snitzer 2018-01-08 @1795 add_disk_no_queue_reg(md->disk);
7e51f257e87297 Mike Anderson 2006-03-27 1796 format_dev_t(md->name, MKDEV(_major, minor));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1797
670368a8ddc5df Tejun Heo 2013-07-30 1798 md->wq = alloc_workqueue("kdmflush", WQ_MEM_RECLAIM, 0);
304f3f6a583013 Milan Broz 2008-02-08 1799 if (!md->wq)
0f20972f7bf692 Mike Snitzer 2015-04-28 1800 goto bad;
304f3f6a583013 Milan Broz 2008-02-08 1801
fd2ed4d252701d Mikulas Patocka 2013-08-16 1802 dm_stats_init(&md->stats);
fd2ed4d252701d Mikulas Patocka 2013-08-16 1803
ba61fdd17d73dd Jeff Mahoney 2006-06-26 1804 /* Populate the mapping, nobody knows we exist yet */
f32c10b09940cf Jeff Mahoney 2006-06-26 1805 spin_lock(&_minor_lock);
ba61fdd17d73dd Jeff Mahoney 2006-06-26 1806 old_md = idr_replace(&_minor_idr, md, minor);
f32c10b09940cf Jeff Mahoney 2006-06-26 1807 spin_unlock(&_minor_lock);
ba61fdd17d73dd Jeff Mahoney 2006-06-26 1808
ba61fdd17d73dd Jeff Mahoney 2006-06-26 1809 BUG_ON(old_md != MINOR_ALLOCED);
ba61fdd17d73dd Jeff Mahoney 2006-06-26 1810
^1da177e4c3f41 Linus Torvalds 2005-04-16 1811 return md;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1812
0f20972f7bf692 Mike Snitzer 2015-04-28 1813 bad:
0f20972f7bf692 Mike Snitzer 2015-04-28 1814 cleanup_mapped_device(md);
83d5e5b0af907d Mikulas Patocka 2013-07-10 1815 bad_io_barrier:
^1da177e4c3f41 Linus Torvalds 2005-04-16 1816 free_minor(minor);
6ed7ade89657e7 Milan Broz 2008-02-08 1817 bad_minor:
10da4f795f965f Jeff Mahoney 2006-06-26 1818 module_put(THIS_MODULE);
6ed7ade89657e7 Milan Broz 2008-02-08 1819 bad_module_get:
856eb0916d181d Mikulas Patocka 2017-10-31 1820 kvfree(md);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1821 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1822 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1823

:::::: The code at line 1795 was first introduced by commit
:::::: c100ec49fdd2222836ff8a17c7bfcc7611d2ee2b dm: fix incomplete request_queue initialization

:::::: TO: Mike Snitzer <snitzer@xxxxxxxxxx>
:::::: CC: Jens Axboe <axboe@xxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip