[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170415185553.16098-10-matias@cnexlabs.com>
Date: Sat, 15 Apr 2017 20:55:43 +0200
From: Matias Bjørling <matias@...xlabs.com>
To: <axboe@...com>
CC: <linux-block@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Javier González <jg@...htnvm.io>,
Javier González <javier@...xlabs.com>,
Matias Bjørling <matias@...xlabs.com>
Subject: [GIT PULL 09/19] lightnvm: fix cleanup order of disk on init error
From: Javier González <jg@...htnvm.io>
Reorder disk allocation such that the disk structure can be put
safely.
Signed-off-by: Javier González <javier@...xlabs.com>
Signed-off-by: Matias Bjørling <matias@...xlabs.com>
---
drivers/lightnvm/core.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 5eea3d5..5f84d2a 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -264,15 +264,15 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
goto err_t;
}
+ tdisk = alloc_disk(0);
+ if (!tdisk)
+ goto err_dev;
+
tqueue = blk_alloc_queue_node(GFP_KERNEL, dev->q->node);
if (!tqueue)
- goto err_dev;
+ goto err_disk;
blk_queue_make_request(tqueue, tt->make_rq);
- tdisk = alloc_disk(0);
- if (!tdisk)
- goto err_queue;
-
sprintf(tdisk->disk_name, "%s", create->tgtname);
tdisk->flags = GENHD_FL_EXT_DEVT;
tdisk->major = 0;
@@ -308,9 +308,9 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
if (tt->exit)
tt->exit(targetdata);
err_init:
- put_disk(tdisk);
-err_queue:
blk_cleanup_queue(tqueue);
+err_disk:
+ put_disk(tdisk);
err_dev:
nvm_remove_tgt_dev(tgt_dev, 0);
err_t:
--
2.9.3
Powered by blists - more mailing lists