Change-Id: I0e36d8b842a29b67afcc411330700238b428e746
Signed-off-by: Chunming Zhou <david1.z...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 963a14e..35761bd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -97,7 +97,8 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev,
                return -ENOMEM;
 
        mutex_lock(&amdgpu_ctx_lock);
-       r = idr_alloc(&amdgpu_ctx_idr, ctx, 1, 0, GFP_KERNEL);
+       /* allocate progressively higher ids until idr counter wraps */
+       r = idr_alloc_cyclic(&amdgpu_ctx_idr, ctx, 1, 0, GFP_KERNEL);
        if (r < 0) {
                mutex_unlock(&amdgpu_ctx_lock);
                kfree(ctx);
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to