| .. | .. |
|---|
| 242 | 242 | { |
|---|
| 243 | 243 | struct request_queue *q = hctx->queue; |
|---|
| 244 | 244 | struct blk_mq_ctx *ctx; |
|---|
| 245 | | - int i, ret; |
|---|
| 245 | + int i, j, ret; |
|---|
| 246 | 246 | |
|---|
| 247 | 247 | if (!hctx->nr_ctx) |
|---|
| 248 | 248 | return 0; |
|---|
| .. | .. |
|---|
| 254 | 254 | hctx_for_each_ctx(hctx, ctx, i) { |
|---|
| 255 | 255 | ret = kobject_add(&ctx->kobj, &hctx->kobj, "cpu%u", ctx->cpu); |
|---|
| 256 | 256 | if (ret) |
|---|
| 257 | | - break; |
|---|
| 257 | + goto out; |
|---|
| 258 | 258 | } |
|---|
| 259 | 259 | |
|---|
| 260 | + return 0; |
|---|
| 261 | +out: |
|---|
| 262 | + hctx_for_each_ctx(hctx, ctx, j) { |
|---|
| 263 | + if (j < i) |
|---|
| 264 | + kobject_del(&ctx->kobj); |
|---|
| 265 | + } |
|---|
| 266 | + kobject_del(&hctx->kobj); |
|---|
| 260 | 267 | return ret; |
|---|
| 261 | 268 | } |
|---|
| 262 | 269 | |
|---|