diff options
author | Jinlong Chen <nickyc975@zju.edu.cn> | 2022-11-02 03:52:29 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-11-02 15:36:50 +0100 |
commit | 7edfd68165b8dab8cde231728ff092a625469eb7 (patch) | |
tree | c190a323939e3e71005133164dc6ef8a7802623e /block/blk-mq.c | |
parent | nvme: use blk_mq_[un]quiesce_tagset (diff) | |
download | linux-7edfd68165b8dab8cde231728ff092a625469eb7.tar.xz linux-7edfd68165b8dab8cde231728ff092a625469eb7.zip |
blk-mq: improve error handling in blk_mq_alloc_rq_map()
Use goto-style error handling like we do elsewhere in the kernel.
Signed-off-by: Jinlong Chen <nickyc975@zju.edu.cn>
Link: https://lore.kernel.org/r/bbbc2d9b17b137798c7fb92042141ca4cbbc58cc.1667356813.git.nickyc975@zju.edu.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index bae6f81c39b3..d4824b53f6b2 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3305,21 +3305,22 @@ static struct blk_mq_tags *blk_mq_alloc_rq_map(struct blk_mq_tag_set *set, tags->rqs = kcalloc_node(nr_tags, sizeof(struct request *), GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, node); - if (!tags->rqs) { - blk_mq_free_tags(tags); - return NULL; - } + if (!tags->rqs) + goto err_free_tags; tags->static_rqs = kcalloc_node(nr_tags, sizeof(struct request *), GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY, node); - if (!tags->static_rqs) { - kfree(tags->rqs); - blk_mq_free_tags(tags); - return NULL; - } + if (!tags->static_rqs) + goto err_free_rqs; return tags; + +err_free_rqs: + kfree(tags->rqs); +err_free_tags: + blk_mq_free_tags(tags); + return NULL; } static int blk_mq_init_request(struct blk_mq_tag_set *set, struct request *rq, |