diff options
author | Christoph Hellwig <hch@lst.de> | 2018-11-14 17:02:12 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-11-15 12:13:26 -0700 |
commit | 04be60b5e4e03fd3d58f7f25b782240a45272fb0 (patch) | |
tree | 8d3aef64ac6cdfbe5971460c07c5fcebcf59b227 /block/blk-cgroup.c | |
parent | b6676f653f13f83582985bc713525a48d735b2a3 (diff) | |
download | linux-04be60b5e4e03fd3d58f7f25b782240a45272fb0.tar.bz2 |
blk-cgroup: consolidate error handling in blkcg_init_queue
Use a goto label to merge two identical pieces of error handling code.
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r-- | block/blk-cgroup.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 3296c0b7353a..717ab38a6c67 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1173,21 +1173,19 @@ int blkcg_init_queue(struct request_queue *q) radix_tree_preload_end(); ret = blk_iolatency_init(q); - if (ret) { - spin_lock_irq(q->queue_lock); - blkg_destroy_all(q); - spin_unlock_irq(q->queue_lock); - return ret; - } + if (ret) + goto err_destroy_all; ret = blk_throtl_init(q); - if (ret) { - spin_lock_irq(q->queue_lock); - blkg_destroy_all(q); - spin_unlock_irq(q->queue_lock); - } - return ret; + if (ret) + goto err_destroy_all; + return 0; +err_destroy_all: + spin_lock_irq(q->queue_lock); + blkg_destroy_all(q); + spin_unlock_irq(q->queue_lock); + return ret; err_unlock: spin_unlock_irq(q->queue_lock); rcu_read_unlock(); |