summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2012-08-30 10:10:52 -0700
committerJens Axboe <axboe@kernel.dk>2012-10-04 11:04:37 +0200
commit5e6685d9a8313c38d26dd7ba319cc7607ba70cb3 (patch)
treebf9ae1d0e44fe3d075c21e3b45e19a6ed79e6371
parent3473fd24d2004f92ddf3968d68f615382675f73f (diff)
blk-mq: more mem init fixes
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-mq.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 531b572def38..b772d48ed165 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -677,11 +677,8 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_reg *reg)
for (i = 0; i < reg->nr_hw_queues; i++) {
hctxs[i] = reg->ops->alloc_hctx(reg, i);
- if (!hctxs[i]) {
- while (i--)
- reg->ops->free_hctx(hctxs[i], i);
+ if (!hctxs[i])
goto err_hctxs;
- }
}
q = blk_alloc_queue_node(GFP_KERNEL, reg->numa_node);
@@ -773,6 +770,11 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_reg *reg)
return q;
err_hctxs:
+ for (i = 0; i < reg->nr_hw_queues; i++) {
+ if (!hctxs[i])
+ break;
+ reg->ops->free_hctx(hctxs[i], i);
+ }
kfree(hctxs);
err_percpu:
free_percpu(ctx);