diff options
author | Dan Williams <dan.j.williams@intel.com> | 2016-07-24 18:05:44 +0300 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2016-07-24 18:05:44 +0300 |
commit | 0606263f24f3d64960de742c55894190b5df903b (patch) | |
tree | 673894f227c1a761f601ad7bdc1ceef003bb85cb /drivers/nvdimm/blk.c | |
parent | a72255983f12f31f0c8d8275fb1a781546cfacb7 (diff) | |
parent | d4c5725d57323e2348940fcc6416072671a9b432 (diff) | |
download | linux-0606263f24f3d64960de742c55894190b5df903b.tar.xz |
Merge branch 'for-4.8/libnvdimm' into libnvdimm-for-next
Diffstat (limited to 'drivers/nvdimm/blk.c')
-rw-r--r-- | drivers/nvdimm/blk.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/nvdimm/blk.c b/drivers/nvdimm/blk.c index 495e06d9f7e7..dfe691cf4d74 100644 --- a/drivers/nvdimm/blk.c +++ b/drivers/nvdimm/blk.c @@ -267,10 +267,8 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk) q = blk_alloc_queue(GFP_KERNEL); if (!q) return -ENOMEM; - if (devm_add_action(dev, nd_blk_release_queue, q)) { - blk_cleanup_queue(q); + if (devm_add_action_or_reset(dev, nd_blk_release_queue, q)) return -ENOMEM; - } blk_queue_make_request(q, nd_blk_make_request); blk_queue_max_hw_sectors(q, UINT_MAX); @@ -282,10 +280,6 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk) disk = alloc_disk(0); if (!disk) return -ENOMEM; - if (devm_add_action(dev, nd_blk_release_disk, disk)) { - put_disk(disk); - return -ENOMEM; - } disk->driverfs_dev = dev; disk->first_minor = 0; @@ -296,6 +290,9 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk) set_capacity(disk, 0); add_disk(disk); + if (devm_add_action_or_reset(dev, nd_blk_release_disk, disk)) + return -ENOMEM; + if (nsblk_meta_size(nsblk)) { int rc = nd_integrity_init(disk, nsblk_meta_size(nsblk)); |