Skip to contentSkip to conversation

drm/amdgpu: use failed label to handle context init failure

PATCH In review Huang Rui 2 participants 2 messages Oct 26, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Huang Rui

author
#0 lore raw

PATCH 1/1 drm/amdgpu: use failed label to handle context init failure

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +9 -9
index 6d90d7b..d7df6e0 100644
@@ -56,18 +56,18 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx)
 		r = amd_sched_entity_init(&ring->sched, &ctx->rings[i].entity,
 					  rq, amdgpu_sched_jobs);
 		if (r)
-			break;
+			goto failed;
 	}
 
-	if (i < adev->num_rings) {
-		for (j = 0; j < i; j++)
-			amd_sched_entity_fini(&adev->rings[j]->sched,
-					      &ctx->rings[j].entity);
-		kfree(ctx->fences);
-		ctx->fences = NULL;
-		return r;
-	}
 	return 0;
+
+failed:
+	for (j = 0; j < i; j++)
+		amd_sched_entity_fini(&adev->rings[j]->sched,
+				      &ctx->rings[j].entity);
+	kfree(ctx->fences);
+	ctx->fences = NULL;
+	return r;
 }
 
 static void amdgpu_ctx_fini(struct amdgpu_ctx *ctx)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1477473118-27889-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 1 line · Huang Rui
Quoted 39 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +9 -10
index 6d90d7b..d7df6e0 100644
@@ -56,18 +56,18 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx)
                r = amd_sched_entity_init(&ring->sched, &ctx->rings[i].entity,
                                          rq, amdgpu_sched_jobs);
                if (r)
-                       break;
+                       goto failed;
        }
 
-       if (i < adev->num_rings) {
-               for (j = 0; j < i; j++)
-                       amd_sched_entity_fini(&adev->rings[j]->sched,
-                                             &ctx->rings[j].entity);
-               kfree(ctx->fences);
-               ctx->fences = NULL;
-               return r;
-       }
        return 0;
+
+failed:
+       for (j = 0; j < i; j++)
+               amd_sched_entity_fini(&adev->rings[j]->sched,
+                                     &ctx->rings[j].entity);
+       kfree(ctx->fences);
+       ctx->fences = NULL;
+       return r;
 }
 
 static void amdgpu_ctx_fini(struct amdgpu_ctx *ctx)
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx