summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/lightnvm/core.c')
-rw-r--r--drivers/lightnvm/core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index b2cd3d6f2a31..9bfe0352d093 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -289,6 +289,9 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
set_capacity(tdisk, tt->capacity(targetdata));
add_disk(tdisk);
+ if (tt->sysfs_init && tt->sysfs_init(tdisk))
+ goto err_sysfs;
+
t->type = tt;
t->disk = tdisk;
t->dev = tgt_dev;
@@ -298,6 +301,9 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
mutex_unlock(&dev->mlock);
return 0;
+err_sysfs:
+ if (tt->exit)
+ tt->exit(targetdata);
err_init:
put_disk(tdisk);
err_queue:
@@ -320,6 +326,9 @@ static void __nvm_remove_target(struct nvm_target *t)
del_gendisk(tdisk);
blk_cleanup_queue(q);
+ if (tt->sysfs_exit)
+ tt->sysfs_exit(tdisk);
+
if (tt->exit)
tt->exit(tdisk->private_data);