提交 edad2e66 编写于 作者: M Matias Bjørling 提交者: Jens Axboe

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: NMatias Bjørling <m@bjorling.me>
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 4264c980
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册