LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [mcgrof:20210818-add-disk-error-handling-v2 160/160] drivers/lightnvm/core.c:400:9: warning: ignoring return value of 'add_disk' declared with attribute 'warn_unused_result'
@ 2021-08-18 15:12 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-18 15:12 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: kbuild-all, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 10958 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git 20210818-add-disk-error-handling-v2
head:   0517c8bf82eb7da58caada94869afb0957f57c81
commit: 0517c8bf82eb7da58caada94869afb0957f57c81 [160/160] block: add __must_check for *add_disk*() callers
config: arc-randconfig-r043-20210818 (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.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
        # https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/commit/?id=0517c8bf82eb7da58caada94869afb0957f57c81
        git remote add mcgrof https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git
        git fetch --no-tags mcgrof 20210818-add-disk-error-handling-v2
        git checkout 0517c8bf82eb7da58caada94869afb0957f57c81
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc 

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

   drivers/lightnvm/core.c: In function 'nvm_create_tgt':
>> drivers/lightnvm/core.c:400:9: warning: ignoring return value of 'add_disk' declared with attribute 'warn_unused_result' [-Wunused-result]
     400 |         add_disk(tdisk);
         |         ^~~~~~~~~~~~~~~


vim +400 drivers/lightnvm/core.c

e53927393b9987 Javier González   2018-01-05  304  
ade69e2432b795 Matias Bjørling   2017-01-31  305  static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
ade69e2432b795 Matias Bjørling   2017-01-31  306  {
e53927393b9987 Javier González   2018-01-05  307  	struct nvm_ioctl_create_extended e;
ade69e2432b795 Matias Bjørling   2017-01-31  308  	struct gendisk *tdisk;
ade69e2432b795 Matias Bjørling   2017-01-31  309  	struct nvm_tgt_type *tt;
ade69e2432b795 Matias Bjørling   2017-01-31  310  	struct nvm_target *t;
ade69e2432b795 Matias Bjørling   2017-01-31  311  	struct nvm_tgt_dev *tgt_dev;
ade69e2432b795 Matias Bjørling   2017-01-31  312  	void *targetdata;
a14669ebc0e294 Igor Konopko      2019-05-04  313  	unsigned int mdts;
8d77bb8276062f Rakesh Pandit     2017-04-20  314  	int ret;
ade69e2432b795 Matias Bjørling   2017-01-31  315  
e53927393b9987 Javier González   2018-01-05  316  	switch (create->conf.type) {
e53927393b9987 Javier González   2018-01-05  317  	case NVM_CONFIG_TYPE_SIMPLE:
e53927393b9987 Javier González   2018-01-05  318  		ret = __nvm_config_simple(dev, &create->conf.s);
e53927393b9987 Javier González   2018-01-05  319  		if (ret)
e53927393b9987 Javier González   2018-01-05  320  			return ret;
e53927393b9987 Javier González   2018-01-05  321  
e53927393b9987 Javier González   2018-01-05  322  		e.lun_begin = create->conf.s.lun_begin;
e53927393b9987 Javier González   2018-01-05  323  		e.lun_end = create->conf.s.lun_end;
e53927393b9987 Javier González   2018-01-05  324  		e.op = NVM_TARGET_DEFAULT_OP;
e53927393b9987 Javier González   2018-01-05  325  		break;
e53927393b9987 Javier González   2018-01-05  326  	case NVM_CONFIG_TYPE_EXTENDED:
e53927393b9987 Javier González   2018-01-05  327  		ret = __nvm_config_extended(dev, &create->conf.e);
e53927393b9987 Javier González   2018-01-05  328  		if (ret)
e53927393b9987 Javier González   2018-01-05  329  			return ret;
e53927393b9987 Javier González   2018-01-05  330  
e53927393b9987 Javier González   2018-01-05  331  		e = create->conf.e;
e53927393b9987 Javier González   2018-01-05  332  		break;
e53927393b9987 Javier González   2018-01-05  333  	default:
43db059ea4b7e9 Minwoo Im         2019-09-05  334  		pr_err("config type not valid\n");
e53927393b9987 Javier González   2018-01-05  335  		return -EINVAL;
e53927393b9987 Javier González   2018-01-05  336  	}
e53927393b9987 Javier González   2018-01-05  337  
e29c80e6dd70d6 Javier González   2018-01-05  338  	tt = nvm_find_target_type(create->tgttype);
ade69e2432b795 Matias Bjørling   2017-01-31  339  	if (!tt) {
43db059ea4b7e9 Minwoo Im         2019-09-05  340  		pr_err("target type %s not found\n", create->tgttype);
ade69e2432b795 Matias Bjørling   2017-01-31  341  		return -EINVAL;
ade69e2432b795 Matias Bjørling   2017-01-31  342  	}
ade69e2432b795 Matias Bjørling   2017-01-31  343  
656e33ca3d4051 Matias Bjørling   2018-10-09  344  	if ((tt->flags & NVM_TGT_F_HOST_L2P) != (dev->geo.dom & NVM_RSP_L2P)) {
43db059ea4b7e9 Minwoo Im         2019-09-05  345  		pr_err("device is incompatible with target L2P type.\n");
656e33ca3d4051 Matias Bjørling   2018-10-09  346  		return -EINVAL;
656e33ca3d4051 Matias Bjørling   2018-10-09  347  	}
656e33ca3d4051 Matias Bjørling   2018-10-09  348  
bd77b23b40370f Javier González   2018-01-05  349  	if (nvm_target_exists(create->tgtname)) {
43db059ea4b7e9 Minwoo Im         2019-09-05  350  		pr_err("target name already exists (%s)\n",
bd77b23b40370f Javier González   2018-01-05  351  							create->tgtname);
ade69e2432b795 Matias Bjørling   2017-01-31  352  		return -EINVAL;
ade69e2432b795 Matias Bjørling   2017-01-31  353  	}
ade69e2432b795 Matias Bjørling   2017-01-31  354  
e53927393b9987 Javier González   2018-01-05  355  	ret = nvm_reserve_luns(dev, e.lun_begin, e.lun_end);
12e9a6d62236da Rakesh Pandit     2017-06-27  356  	if (ret)
12e9a6d62236da Rakesh Pandit     2017-06-27  357  		return ret;
ade69e2432b795 Matias Bjørling   2017-01-31  358  
ade69e2432b795 Matias Bjørling   2017-01-31  359  	t = kmalloc(sizeof(struct nvm_target), GFP_KERNEL);
8d77bb8276062f Rakesh Pandit     2017-04-20  360  	if (!t) {
8d77bb8276062f Rakesh Pandit     2017-04-20  361  		ret = -ENOMEM;
ade69e2432b795 Matias Bjørling   2017-01-31  362  		goto err_reserve;
8d77bb8276062f Rakesh Pandit     2017-04-20  363  	}
ade69e2432b795 Matias Bjørling   2017-01-31  364  
e53927393b9987 Javier González   2018-01-05  365  	tgt_dev = nvm_create_tgt_dev(dev, e.lun_begin, e.lun_end, e.op);
ade69e2432b795 Matias Bjørling   2017-01-31  366  	if (!tgt_dev) {
43db059ea4b7e9 Minwoo Im         2019-09-05  367  		pr_err("could not create target device\n");
8d77bb8276062f Rakesh Pandit     2017-04-20  368  		ret = -ENOMEM;
ade69e2432b795 Matias Bjørling   2017-01-31  369  		goto err_t;
ade69e2432b795 Matias Bjørling   2017-01-31  370  	}
ade69e2432b795 Matias Bjørling   2017-01-31  371  
1aabd53a4b49ad Christoph Hellwig 2021-05-21  372  	tdisk = blk_alloc_disk(dev->q->node);
8d77bb8276062f Rakesh Pandit     2017-04-20  373  	if (!tdisk) {
8d77bb8276062f Rakesh Pandit     2017-04-20  374  		ret = -ENOMEM;
7d1ef2f408abec Javier González   2017-04-15  375  		goto err_dev;
8d77bb8276062f Rakesh Pandit     2017-04-20  376  	}
7d1ef2f408abec Javier González   2017-04-15  377  
6eb082452df121 Javier González   2017-04-15  378  	strlcpy(tdisk->disk_name, create->tgtname, sizeof(tdisk->disk_name));
ade69e2432b795 Matias Bjørling   2017-01-31  379  	tdisk->major = 0;
ade69e2432b795 Matias Bjørling   2017-01-31  380  	tdisk->first_minor = 0;
c62b37d96b6eb3 Christoph Hellwig 2020-07-01  381  	tdisk->fops = tt->bops;
ade69e2432b795 Matias Bjørling   2017-01-31  382  
4af3f75d7992dd Javier González   2017-04-15  383  	targetdata = tt->init(tgt_dev, tdisk, create->flags);
8d77bb8276062f Rakesh Pandit     2017-04-20  384  	if (IS_ERR(targetdata)) {
8d77bb8276062f Rakesh Pandit     2017-04-20  385  		ret = PTR_ERR(targetdata);
ade69e2432b795 Matias Bjørling   2017-01-31  386  		goto err_init;
8d77bb8276062f Rakesh Pandit     2017-04-20  387  	}
ade69e2432b795 Matias Bjørling   2017-01-31  388  
ade69e2432b795 Matias Bjørling   2017-01-31  389  	tdisk->private_data = targetdata;
1aabd53a4b49ad Christoph Hellwig 2021-05-21  390  	tdisk->queue->queuedata = targetdata;
ade69e2432b795 Matias Bjørling   2017-01-31  391  
a14669ebc0e294 Igor Konopko      2019-05-04  392  	mdts = (dev->geo.csecs >> 9) * NVM_MAX_VLBA;
a14669ebc0e294 Igor Konopko      2019-05-04  393  	if (dev->geo.mdts) {
a14669ebc0e294 Igor Konopko      2019-05-04  394  		mdts = min_t(u32, dev->geo.mdts,
e46f4e4822bdec Javier González   2018-03-30  395  				(dev->geo.csecs >> 9) * NVM_MAX_VLBA);
a14669ebc0e294 Igor Konopko      2019-05-04  396  	}
1aabd53a4b49ad Christoph Hellwig 2021-05-21  397  	blk_queue_max_hw_sectors(tdisk->queue, mdts);
ade69e2432b795 Matias Bjørling   2017-01-31  398  
ade69e2432b795 Matias Bjørling   2017-01-31  399  	set_capacity(tdisk, tt->capacity(targetdata));
ade69e2432b795 Matias Bjørling   2017-01-31 @400  	add_disk(tdisk);
ade69e2432b795 Matias Bjørling   2017-01-31  401  
8d77bb8276062f Rakesh Pandit     2017-04-20  402  	if (tt->sysfs_init && tt->sysfs_init(tdisk)) {
8d77bb8276062f Rakesh Pandit     2017-04-20  403  		ret = -ENOMEM;
9a69b0ed6257ae Javier González   2017-01-31  404  		goto err_sysfs;
8d77bb8276062f Rakesh Pandit     2017-04-20  405  	}
9a69b0ed6257ae Javier González   2017-01-31  406  
ade69e2432b795 Matias Bjørling   2017-01-31  407  	t->type = tt;
ade69e2432b795 Matias Bjørling   2017-01-31  408  	t->disk = tdisk;
ade69e2432b795 Matias Bjørling   2017-01-31  409  	t->dev = tgt_dev;
ade69e2432b795 Matias Bjørling   2017-01-31  410  
ade69e2432b795 Matias Bjørling   2017-01-31  411  	mutex_lock(&dev->mlock);
ade69e2432b795 Matias Bjørling   2017-01-31  412  	list_add_tail(&t->list, &dev->targets);
ade69e2432b795 Matias Bjørling   2017-01-31  413  	mutex_unlock(&dev->mlock);
ade69e2432b795 Matias Bjørling   2017-01-31  414  
900148296b78c6 Rakesh Pandit     2017-10-13  415  	__module_get(tt->owner);
900148296b78c6 Rakesh Pandit     2017-10-13  416  
ade69e2432b795 Matias Bjørling   2017-01-31  417  	return 0;
9a69b0ed6257ae Javier González   2017-01-31  418  err_sysfs:
9a69b0ed6257ae Javier González   2017-01-31  419  	if (tt->exit)
a7c9e9109ca114 Javier González   2018-06-01  420  		tt->exit(targetdata, true);
ade69e2432b795 Matias Bjørling   2017-01-31  421  err_init:
1aabd53a4b49ad Christoph Hellwig 2021-05-21  422  	blk_cleanup_disk(tdisk);
ade69e2432b795 Matias Bjørling   2017-01-31  423  err_dev:
edee1bdd66bf0f Javier González   2017-04-15  424  	nvm_remove_tgt_dev(tgt_dev, 0);
ade69e2432b795 Matias Bjørling   2017-01-31  425  err_t:
ade69e2432b795 Matias Bjørling   2017-01-31  426  	kfree(t);
ade69e2432b795 Matias Bjørling   2017-01-31  427  err_reserve:
e53927393b9987 Javier González   2018-01-05  428  	nvm_release_luns_err(dev, e.lun_begin, e.lun_end);
8d77bb8276062f Rakesh Pandit     2017-04-20  429  	return ret;
ade69e2432b795 Matias Bjørling   2017-01-31  430  }
ade69e2432b795 Matias Bjørling   2017-01-31  431  

:::::: The code at line 400 was first introduced by commit
:::::: ade69e2432b795c76653e1dfa09c684549826a50 lightnvm: merge gennvm with core

:::::: TO: Matias Bjørling <matias@cnexlabs.com>
:::::: CC: Jens Axboe <axboe@fb.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42907 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-18 15:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 15:12 [mcgrof:20210818-add-disk-error-handling-v2 160/160] drivers/lightnvm/core.c:400:9: warning: ignoring return value of 'add_disk' declared with attribute 'warn_unused_result' kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).