All of lore.kernel.org
 help / color / mirror / Atom feed
* [mcgrof:20210818-add-disk-error-handling-v2 146/160] drivers/mtd/ubi/block.c:468 ubiblock_create() warn: '&dev->list' not removed from list
@ 2021-08-19  9:02 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-19  9:02 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Luis Chamberlain <mcgrof@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git 20210818-add-disk-error-handling-v2
head:   0517c8bf82eb7da58caada94869afb0957f57c81
commit: 690074f670988d6f0b71291c8e9b26c4d0bbcb46 [146/160] mtd/ubi/block: add error handling support for add_disk()
:::::: branch date: 26 hours ago
:::::: commit date: 26 hours ago
config: x86_64-randconfig-m001-20210818 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/mtd/ubi/block.c:468 ubiblock_create() warn: '&dev->list' not removed from list

vim +468 drivers/mtd/ubi/block.c

e46131b9fd3115 Richard Weinberger 2019-09-01  365  
4d283ee2517303 Artem Bityutskiy   2014-03-04  366  int ubiblock_create(struct ubi_volume_info *vi)
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  367  {
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  368  	struct ubiblock *dev;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  369  	struct gendisk *gd;
e46131b9fd3115 Richard Weinberger 2019-09-01  370  	u64 disk_capacity;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  371  	int ret;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  372  
e46131b9fd3115 Richard Weinberger 2019-09-01  373  	ret = calc_disk_capacity(vi, &disk_capacity);
e46131b9fd3115 Richard Weinberger 2019-09-01  374  	if (ret) {
e46131b9fd3115 Richard Weinberger 2019-09-01  375  		return ret;
e46131b9fd3115 Richard Weinberger 2019-09-01  376  	}
e46131b9fd3115 Richard Weinberger 2019-09-01  377  
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  378  	/* Check that the volume isn't already handled */
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  379  	mutex_lock(&devices_mutex);
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  380  	if (find_dev_nolock(vi->ubi_num, vi->vol_id)) {
7f29ae9f977bcd Bradley Bolen      2018-01-18  381  		ret = -EEXIST;
7f29ae9f977bcd Bradley Bolen      2018-01-18  382  		goto out_unlock;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  383  	}
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  384  
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  385  	dev = kzalloc(sizeof(struct ubiblock), GFP_KERNEL);
7f29ae9f977bcd Bradley Bolen      2018-01-18  386  	if (!dev) {
7f29ae9f977bcd Bradley Bolen      2018-01-18  387  		ret = -ENOMEM;
7f29ae9f977bcd Bradley Bolen      2018-01-18  388  		goto out_unlock;
7f29ae9f977bcd Bradley Bolen      2018-01-18  389  	}
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  390  
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  391  	mutex_init(&dev->dev_mutex);
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  392  
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  393  	dev->ubi_num = vi->ubi_num;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  394  	dev->vol_id = vi->vol_id;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  395  	dev->leb_size = vi->usable_leb_size;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  396  
77567b25ab9f06 Christoph Hellwig  2021-06-02  397  	dev->tag_set.ops = &ubiblock_mq_ops;
77567b25ab9f06 Christoph Hellwig  2021-06-02  398  	dev->tag_set.queue_depth = 64;
77567b25ab9f06 Christoph Hellwig  2021-06-02  399  	dev->tag_set.numa_node = NUMA_NO_NODE;
77567b25ab9f06 Christoph Hellwig  2021-06-02  400  	dev->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
77567b25ab9f06 Christoph Hellwig  2021-06-02  401  	dev->tag_set.cmd_size = sizeof(struct ubiblock_pdu);
77567b25ab9f06 Christoph Hellwig  2021-06-02  402  	dev->tag_set.driver_data = dev;
77567b25ab9f06 Christoph Hellwig  2021-06-02  403  	dev->tag_set.nr_hw_queues = 1;
77567b25ab9f06 Christoph Hellwig  2021-06-02  404  
77567b25ab9f06 Christoph Hellwig  2021-06-02  405  	ret = blk_mq_alloc_tag_set(&dev->tag_set);
77567b25ab9f06 Christoph Hellwig  2021-06-02  406  	if (ret) {
77567b25ab9f06 Christoph Hellwig  2021-06-02  407  		dev_err(disk_to_dev(dev->gd), "blk_mq_alloc_tag_set failed");
77567b25ab9f06 Christoph Hellwig  2021-06-02  408  		goto out_free_dev;;
77567b25ab9f06 Christoph Hellwig  2021-06-02  409  	}
77567b25ab9f06 Christoph Hellwig  2021-06-02  410  
77567b25ab9f06 Christoph Hellwig  2021-06-02  411  
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  412  	/* Initialize the gendisk of this ubiblock device */
77567b25ab9f06 Christoph Hellwig  2021-06-02  413  	gd = blk_mq_alloc_disk(&dev->tag_set, dev);
77567b25ab9f06 Christoph Hellwig  2021-06-02  414  	if (IS_ERR(gd)) {
77567b25ab9f06 Christoph Hellwig  2021-06-02  415  		ret = PTR_ERR(gd);
77567b25ab9f06 Christoph Hellwig  2021-06-02  416  		goto out_free_tags;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  417  	}
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  418  
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  419  	gd->fops = &ubiblock_ops;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  420  	gd->major = ubiblock_major;
77567b25ab9f06 Christoph Hellwig  2021-06-02  421  	gd->minors = 1;
2bf50d42f3a418 Dan Ehrenberg      2015-03-17  422  	gd->first_minor = idr_alloc(&ubiblock_minor_idr, dev, 0, 0, GFP_KERNEL);
2bf50d42f3a418 Dan Ehrenberg      2015-03-17  423  	if (gd->first_minor < 0) {
2bf50d42f3a418 Dan Ehrenberg      2015-03-17  424  		dev_err(disk_to_dev(gd),
2bf50d42f3a418 Dan Ehrenberg      2015-03-17  425  			"block: dynamic minor allocation failed");
2bf50d42f3a418 Dan Ehrenberg      2015-03-17  426  		ret = -ENODEV;
77567b25ab9f06 Christoph Hellwig  2021-06-02  427  		goto out_cleanup_disk;
2bf50d42f3a418 Dan Ehrenberg      2015-03-17  428  	}
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  429  	gd->private_data = dev;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  430  	sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id);
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  431  	set_capacity(gd, disk_capacity);
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  432  	dev->gd = gd;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  433  
77567b25ab9f06 Christoph Hellwig  2021-06-02  434  	dev->rq = gd->queue;
ff1f48ee3bb3af Richard Weinberger 2015-01-10  435  	blk_queue_max_segments(dev->rq, UBI_MAX_SG_COUNT);
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  436  
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  437  	/*
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  438  	 * Create one workqueue per volume (per registered block device).
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  439  	 * Rembember workqueues are cheap, they're not threads.
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  440  	 */
bebfef150e0b8f Kees Cook          2014-04-07  441  	dev->wq = alloc_workqueue("%s", 0, 0, gd->disk_name);
151d6b21f973c5 Helmut Schaa       2014-05-20  442  	if (!dev->wq) {
151d6b21f973c5 Helmut Schaa       2014-05-20  443  		ret = -ENOMEM;
77567b25ab9f06 Christoph Hellwig  2021-06-02  444  		goto out_remove_minor;
151d6b21f973c5 Helmut Schaa       2014-05-20  445  	}
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  446  
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  447  	list_add_tail(&dev->list, &ubiblock_devices);
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  448  
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  449  	/* Must be the last step: anyone can call file ops from now on */
690074f670988d Luis Chamberlain   2021-07-14  450  	ret = add_disk(dev->gd);
690074f670988d Luis Chamberlain   2021-07-14  451  	if (ret)
690074f670988d Luis Chamberlain   2021-07-14  452  		goto out_destroy_wq;
690074f670988d Luis Chamberlain   2021-07-14  453  
326087033108e7 Tanya Brokhman     2014-10-20  454  	dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
326087033108e7 Tanya Brokhman     2014-10-20  455  		 dev->ubi_num, dev->vol_id, vi->name);
7f29ae9f977bcd Bradley Bolen      2018-01-18  456  	mutex_unlock(&devices_mutex);
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  457  	return 0;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  458  
690074f670988d Luis Chamberlain   2021-07-14  459  out_destroy_wq:
690074f670988d Luis Chamberlain   2021-07-14  460  	destroy_workqueue(dev->wq);
2bf50d42f3a418 Dan Ehrenberg      2015-03-17  461  out_remove_minor:
2bf50d42f3a418 Dan Ehrenberg      2015-03-17  462  	idr_remove(&ubiblock_minor_idr, gd->first_minor);
77567b25ab9f06 Christoph Hellwig  2021-06-02  463  out_cleanup_disk:
77567b25ab9f06 Christoph Hellwig  2021-06-02  464  	blk_cleanup_disk(dev->gd);
77567b25ab9f06 Christoph Hellwig  2021-06-02  465  out_free_tags:
77567b25ab9f06 Christoph Hellwig  2021-06-02  466  	blk_mq_free_tag_set(&dev->tag_set);
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  467  out_free_dev:
9d54c8a33eec78 Ezequiel Garcia    2014-02-25 @468  	kfree(dev);
7f29ae9f977bcd Bradley Bolen      2018-01-18  469  out_unlock:
7f29ae9f977bcd Bradley Bolen      2018-01-18  470  	mutex_unlock(&devices_mutex);
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  471  
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  472  	return ret;
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  473  }
9d54c8a33eec78 Ezequiel Garcia    2014-02-25  474  

:::::: The code at line 468 was first introduced by commit
:::::: 9d54c8a33eec78289b1b3f6e10874719c27ce0a7 UBI: R/O block driver on top of UBI volumes

:::::: TO: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
:::::: CC: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

---
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: 36773 bytes --]

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

only message in thread, other threads:[~2021-08-19  9:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19  9:02 [mcgrof:20210818-add-disk-error-handling-v2 146/160] drivers/mtd/ubi/block.c:468 ubiblock_create() warn: '&dev->list' not removed from list kernel test robot

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.