diff options
author | Huang Rui <ray.huang@amd.com> | 2016-10-26 05:07:03 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-10-27 15:18:09 -0400 |
commit | 8ed8147abc7cf1f689245deb316aabfe2f657ade (patch) | |
tree | a62a6efa049b3ab073a47cec85b1d46b3f75a1c7 /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |
parent | 9982ca681e430907cb7f4e19e2ae4845031d5d59 (diff) |
drm/amdgpu: use failed label to handle context init failure
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index a5e2fcbef0f0..6d86eaef934c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |||
@@ -55,18 +55,18 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx) | |||
55 | r = amd_sched_entity_init(&ring->sched, &ctx->rings[i].entity, | 55 | r = amd_sched_entity_init(&ring->sched, &ctx->rings[i].entity, |
56 | rq, amdgpu_sched_jobs); | 56 | rq, amdgpu_sched_jobs); |
57 | if (r) | 57 | if (r) |
58 | break; | 58 | goto failed; |
59 | } | 59 | } |
60 | 60 | ||
61 | if (i < adev->num_rings) { | ||
62 | for (j = 0; j < i; j++) | ||
63 | amd_sched_entity_fini(&adev->rings[j]->sched, | ||
64 | &ctx->rings[j].entity); | ||
65 | kfree(ctx->fences); | ||
66 | ctx->fences = NULL; | ||
67 | return r; | ||
68 | } | ||
69 | return 0; | 61 | return 0; |
62 | |||
63 | failed: | ||
64 | for (j = 0; j < i; j++) | ||
65 | amd_sched_entity_fini(&adev->rings[j]->sched, | ||
66 | &ctx->rings[j].entity); | ||
67 | kfree(ctx->fences); | ||
68 | ctx->fences = NULL; | ||
69 | return r; | ||
70 | } | 70 | } |
71 | 71 | ||
72 | static void amdgpu_ctx_fini(struct amdgpu_ctx *ctx) | 72 | static void amdgpu_ctx_fini(struct amdgpu_ctx *ctx) |