aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-11-14 11:02:12 -0500
committerJens Axboe <axboe@kernel.dk>2018-11-15 14:13:26 -0500
commit04be60b5e4e03fd3d58f7f25b782240a45272fb0 (patch)
tree8d3aef64ac6cdfbe5971460c07c5fcebcf59b227 /block/blk-cgroup.c
parentb6676f653f13f83582985bc713525a48d735b2a3 (diff)
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.c22
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)
1173 radix_tree_preload_end(); 1173 radix_tree_preload_end();
1174 1174
1175 ret = blk_iolatency_init(q); 1175 ret = blk_iolatency_init(q);
1176 if (ret) { 1176 if (ret)
1177 spin_lock_irq(q->queue_lock); 1177 goto err_destroy_all;
1178 blkg_destroy_all(q);
1179 spin_unlock_irq(q->queue_lock);
1180 return ret;
1181 }
1182 1178
1183 ret = blk_throtl_init(q); 1179 ret = blk_throtl_init(q);
1184 if (ret) { 1180 if (ret)
1185 spin_lock_irq(q->queue_lock); 1181 goto err_destroy_all;
1186 blkg_destroy_all(q); 1182 return 0;
1187 spin_unlock_irq(q->queue_lock);
1188 }
1189 return ret;
1190 1183
1184err_destroy_all:
1185 spin_lock_irq(q->queue_lock);
1186 blkg_destroy_all(q);
1187 spin_unlock_irq(q->queue_lock);
1188 return ret;
1191err_unlock: 1189err_unlock:
1192 spin_unlock_irq(q->queue_lock); 1190 spin_unlock_irq(q->queue_lock);
1193 rcu_read_unlock(); 1191 rcu_read_unlock();