CC: [email protected] CC: [email protected] TO: Luis Chamberlain <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git 20210818-add-disk-error-handling-v2 head: 0517c8bf82eb7da58caada94869afb0957f57c81 commit: c3e706df9f344e3f5756e8ba016db1cf3c36a573 [98/160] nvme: add error handling support for add_disk() :::::: branch date: 8 hours ago :::::: commit date: 8 hours ago config: powerpc64-randconfig-m031-20210816 (attached as .config) compiler: powerpc64-linux-gcc (GCC) 11.2.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> New smatch warnings: drivers/nvme/host/core.c:3807 nvme_alloc_ns() warn: '&ns->list' not removed from list Old smatch warnings: drivers/nvme/host/core.c:787 nvme_configure_directives() warn: missing error code 'ret' drivers/nvme/host/core.c:875 nvme_setup_discard() warn: possible memory leak of 'range' vim +3807 drivers/nvme/host/core.c 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3716 8b7c0ff2d46dad Christoph Hellwig 2020-09-28 3717 static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, 8b7c0ff2d46dad Christoph Hellwig 2020-09-28 3718 struct nvme_ns_ids *ids) 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3719 { 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3720 struct nvme_ns *ns; 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3721 struct gendisk *disk; ac81bfa9867103 Matias Bjørling 2016-09-16 3722 struct nvme_id_ns *id; 9953ab0c5ae722 Christoph Hellwig 2021-04-07 3723 int node = ctrl->numa_node; c3e706df9f344e Luis Chamberlain 2021-07-15 3724 int rc; 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3725 8b7c0ff2d46dad Christoph Hellwig 2020-09-28 3726 if (nvme_identify_ns(ctrl, nsid, ids, &id)) fab72f5a046883 Christoph Hellwig 2020-09-28 3727 return; fab72f5a046883 Christoph Hellwig 2020-09-28 3728 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3729 ns = kzalloc_node(sizeof(*ns), GFP_KERNEL, node); 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3730 if (!ns) fab72f5a046883 Christoph Hellwig 2020-09-28 3731 goto out_free_id; 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3732 f07533796e6abf Christoph Hellwig 2021-07-19 3733 disk = blk_mq_alloc_disk(ctrl->tagset, ns); f07533796e6abf Christoph Hellwig 2021-07-19 3734 if (IS_ERR(disk)) ed754e5deeb17f Christoph Hellwig 2017-11-09 3735 goto out_free_ns; f07533796e6abf Christoph Hellwig 2021-07-19 3736 disk->fops = &nvme_bdev_ops; f07533796e6abf Christoph Hellwig 2021-07-19 3737 disk->private_data = ns; f07533796e6abf Christoph Hellwig 2021-07-19 3738 f07533796e6abf Christoph Hellwig 2021-07-19 3739 ns->disk = disk; f07533796e6abf Christoph Hellwig 2021-07-19 3740 ns->queue = disk->queue; e0596ab2900dfa Logan Gunthorpe 2018-10-04 3741 7d30c81b80ea9b Minwoo Im 2019-07-12 3742 if (ctrl->opts && ctrl->opts->data_digest) 1cb039f3dc1619 Christoph Hellwig 2020-09-24 3743 blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, ns->queue); 958f2a0f8121ae Mikhail Skorzhinskii 2019-07-04 3744 8b904b5b6b58b9 Bart Van Assche 2018-03-07 3745 blk_queue_flag_set(QUEUE_FLAG_NONROT, ns->queue); e0596ab2900dfa Logan Gunthorpe 2018-10-04 3746 if (ctrl->ops->flags & NVME_F_PCI_P2PDMA) e0596ab2900dfa Logan Gunthorpe 2018-10-04 3747 blk_queue_flag_set(QUEUE_FLAG_PCI_P2PDMA, ns->queue); e0596ab2900dfa Logan Gunthorpe 2018-10-04 3748 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3749 ns->ctrl = ctrl; 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3750 kref_init(&ns->kref); 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3751 e1aaf5cacba9d9 Javier González 2020-12-01 3752 if (nvme_init_ns_head(ns, nsid, ids, id->nmic & NVME_NS_NMIC_SHARED)) f07533796e6abf Christoph Hellwig 2021-07-19 3753 goto out_cleanup_disk; cdbff4f26bd9fa Christoph Hellwig 2017-08-16 3754 9953ab0c5ae722 Christoph Hellwig 2021-04-07 3755 /* 9953ab0c5ae722 Christoph Hellwig 2021-04-07 3756 * Without the multipath code enabled, multiple controller per 9953ab0c5ae722 Christoph Hellwig 2021-04-07 3757 * subsystems are visible as devices and thus we cannot use the 9953ab0c5ae722 Christoph Hellwig 2021-04-07 3758 * subsystem instance. 9953ab0c5ae722 Christoph Hellwig 2021-04-07 3759 */ 9953ab0c5ae722 Christoph Hellwig 2021-04-07 3760 if (!nvme_mpath_set_disk_name(ns, disk->disk_name, &disk->flags)) 9953ab0c5ae722 Christoph Hellwig 2021-04-07 3761 sprintf(disk->disk_name, "nvme%dn%d", ctrl->instance, 9953ab0c5ae722 Christoph Hellwig 2021-04-07 3762 ns->head->instance); 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3763 81382f1730d24a Christoph Hellwig 2020-09-28 3764 if (nvme_update_ns_info(ns, id)) f07533796e6abf Christoph Hellwig 2021-07-19 3765 goto out_unlink_ns; 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3766 85136c0102852f Matias Bjørling 2018-12-11 3767 if ((ctrl->quirks & NVME_QUIRK_LIGHTNVM) && id->vs[0] == 0x1) { 9953ab0c5ae722 Christoph Hellwig 2021-04-07 3768 if (nvme_nvm_register(ns, disk->disk_name, node)) { 85136c0102852f Matias Bjørling 2018-12-11 3769 dev_warn(ctrl->device, "LightNVM init failure\n"); f07533796e6abf Christoph Hellwig 2021-07-19 3770 goto out_unlink_ns; 85136c0102852f Matias Bjørling 2018-12-11 3771 } 85136c0102852f Matias Bjørling 2018-12-11 3772 } 85136c0102852f Matias Bjørling 2018-12-11 3773 765cc031cddde4 Jianchao Wang 2018-02-12 3774 down_write(&ctrl->namespaces_rwsem); 32f0c4afb4363e Keith Busch 2016-07-13 3775 list_add_tail(&ns->list, &ctrl->namespaces); 765cc031cddde4 Jianchao Wang 2018-02-12 3776 up_write(&ctrl->namespaces_rwsem); 32f0c4afb4363e Keith Busch 2016-07-13 3777 d22524a4782a94 Christoph Hellwig 2017-10-18 3778 nvme_get_ctrl(ctrl); ac81bfa9867103 Matias Bjørling 2016-09-16 3779 c3e706df9f344e Luis Chamberlain 2021-07-15 3780 rc = device_add_disk(ctrl->device, ns->disk, nvme_ns_id_attr_groups); c3e706df9f344e Luis Chamberlain 2021-07-15 3781 if (rc) c3e706df9f344e Luis Chamberlain 2021-07-15 3782 goto out_cleanup_ns_from_list; c3e706df9f344e Luis Chamberlain 2021-07-15 3783 2637baed78010e Minwoo Im 2021-04-21 3784 if (!nvme_ns_head_multipath(ns->head)) 2637baed78010e Minwoo Im 2021-04-21 3785 nvme_add_ns_cdev(ns); 32acab3181c705 Christoph Hellwig 2017-11-02 3786 0d0b660f214dc4 Christoph Hellwig 2018-05-14 3787 nvme_mpath_add_disk(ns, id); a3646451edd52b Akinobu Mita 2019-06-20 3788 nvme_fault_inject_init(&ns->fault_inject, ns->disk->disk_name); 0d0b660f214dc4 Christoph Hellwig 2018-05-14 3789 kfree(id); 0d0b660f214dc4 Christoph Hellwig 2018-05-14 3790 adce7e9856798d Edmund Nadolski 2019-11-27 3791 return; f07533796e6abf Christoph Hellwig 2021-07-19 3792 c3e706df9f344e Luis Chamberlain 2021-07-15 3793 out_cleanup_ns_from_list: c3e706df9f344e Luis Chamberlain 2021-07-15 3794 down_write(&ctrl->namespaces_rwsem); c3e706df9f344e Luis Chamberlain 2021-07-15 3795 list_del_init(&ns->list); c3e706df9f344e Luis Chamberlain 2021-07-15 3796 up_write(&ctrl->namespaces_rwsem); ed754e5deeb17f Christoph Hellwig 2017-11-09 3797 out_unlink_ns: ed754e5deeb17f Christoph Hellwig 2017-11-09 3798 mutex_lock(&ctrl->subsys->lock); ed754e5deeb17f Christoph Hellwig 2017-11-09 3799 list_del_rcu(&ns->siblings); d567572906d986 Keith Busch 2020-04-09 3800 if (list_empty(&ns->head->list)) d567572906d986 Keith Busch 2020-04-09 3801 list_del_init(&ns->head->entry); ed754e5deeb17f Christoph Hellwig 2017-11-09 3802 mutex_unlock(&ctrl->subsys->lock); a63b83700ba89c Sagi Grimberg 2019-03-13 3803 nvme_put_ns_head(ns->head); f07533796e6abf Christoph Hellwig 2021-07-19 3804 out_cleanup_disk: f07533796e6abf Christoph Hellwig 2021-07-19 3805 blk_cleanup_disk(disk); 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3806 out_free_ns: 5bae7f73d378a9 Christoph Hellwig 2015-11-28 @3807 kfree(ns); fab72f5a046883 Christoph Hellwig 2020-09-28 3808 out_free_id: fab72f5a046883 Christoph Hellwig 2020-09-28 3809 kfree(id); 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3810 } 5bae7f73d378a9 Christoph Hellwig 2015-11-28 3811 :::::: The code at line 3807 was first introduced by commit :::::: 5bae7f73d378a986671a3cad717c721b38f80d9e nvme: move namespace scanning to common code :::::: TO: Christoph Hellwig <[email protected]> :::::: CC: Jens Axboe <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
