summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm
diff options
context:
space:
mode:
authorMatias Bjørling <m@bjorling.me>2015-11-16 15:34:42 +0100
committerJens Axboe <axboe@fb.com>2015-11-16 15:20:31 -0700
commitedad2e6606ee62dd7dfc5b001fae39c5c8015a55 (patch)
tree2adb53a55864f731868a7641d8290139f29dd389 /drivers/lightnvm
parent4264c980e3e9bb904b7f41dc9c64786cc5466bee (diff)
downloadblackbird-op-linux-edad2e6606ee62dd7dfc5b001fae39c5c8015a55.tar.gz
blackbird-op-linux-edad2e6606ee62dd7dfc5b001fae39c5c8015a55.zip
lightnvm: prematurely activate nvm_dev
We register with nvm_devices when there registration can still fail. Move the final registration at the end of the nvm_register function to make sure we are fully registered when added to the nvm_devices list. Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r--drivers/lightnvm/core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 0985a032debc..40e6cfae4585 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -318,10 +318,6 @@ int nvm_register(struct request_queue *q, char *disk_name,
if (ret)
goto err_init;
- down_write(&nvm_lock);
- list_add(&dev->devices, &nvm_devices);
- up_write(&nvm_lock);
-
if (dev->ops->max_phys_sect > 1) {
dev->ppalist_pool = dev->ops->create_dma_pool(dev->q,
"ppalist");
@@ -334,6 +330,10 @@ int nvm_register(struct request_queue *q, char *disk_name,
return -EINVAL;
}
+ down_write(&nvm_lock);
+ list_add(&dev->devices, &nvm_devices);
+ up_write(&nvm_lock);
+
return 0;
err_init:
kfree(dev);
OpenPOWER on IntegriCloud