Source
2858
2858
/* mark the queue as mq asap */
2859
2859
q->mq_ops = set->ops;
2860
2860
2861
2861
q->poll_cb = blk_stat_alloc_callback(blk_mq_poll_stats_fn,
2862
2862
blk_mq_poll_stats_bkt,
2863
2863
BLK_MQ_POLL_STATS_BKTS, q);
2864
2864
if (!q->poll_cb)
2865
2865
goto err_exit;
2866
2866
2867
2867
if (blk_mq_alloc_ctxs(q))
2868
-
goto err_exit;
2868
+
goto err_poll;
2869
2869
2870
2870
/* init q->mq_kobj and sw queues' kobjects */
2871
2871
blk_mq_sysfs_init(q);
2872
2872
2873
2873
q->nr_queues = nr_hw_queues(set);
2874
2874
q->queue_hw_ctx = kcalloc_node(q->nr_queues, sizeof(*(q->queue_hw_ctx)),
2875
2875
GFP_KERNEL, set->numa_node);
2876
2876
if (!q->queue_hw_ctx)
2877
2877
goto err_sys_init;
2878
2878
2922
2922
if (ret)
2923
2923
return ERR_PTR(ret);
2924
2924
}
2925
2925
2926
2926
return q;
2927
2927
2928
2928
err_hctxs:
2929
2929
kfree(q->queue_hw_ctx);
2930
2930
err_sys_init:
2931
2931
blk_mq_sysfs_deinit(q);
2932
+
err_poll:
2933
+
blk_stat_free_callback(q->poll_cb);
2934
+
q->poll_cb = NULL;
2932
2935
err_exit:
2933
2936
q->mq_ops = NULL;
2934
2937
return ERR_PTR(-ENOMEM);
2935
2938
}
2936
2939
EXPORT_SYMBOL(blk_mq_init_allocated_queue);
2937
2940
2938
2941
/* tags can _not_ be used after returning from blk_mq_exit_queue */
2939
2942
void blk_mq_exit_queue(struct request_queue *q)
2940
2943
{
2941
2944
struct blk_mq_tag_set *set = q->tag_set;