Commit b24c683a authored by Nicolai Hähnle's avatar Nicolai Hähnle Committed by Alex Deucher

drm/radeon: only increment sync_seq when a fence is really emitted

In the rare situation where the kmalloc fails we're probably screwed anyway,
but let's try to be more robust about it.
Reviewed-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
Signed-off-by: default avatarNicolai Hähnle <Nicolai.Haehnle@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5fc45397
...@@ -130,7 +130,7 @@ int radeon_fence_emit(struct radeon_device *rdev, ...@@ -130,7 +130,7 @@ int radeon_fence_emit(struct radeon_device *rdev,
struct radeon_fence **fence, struct radeon_fence **fence,
int ring) int ring)
{ {
u64 seq = ++rdev->fence_drv[ring].sync_seq[ring]; u64 seq;
/* we are protected by the ring emission mutex */ /* we are protected by the ring emission mutex */
*fence = kmalloc(sizeof(struct radeon_fence), GFP_KERNEL); *fence = kmalloc(sizeof(struct radeon_fence), GFP_KERNEL);
...@@ -138,7 +138,7 @@ int radeon_fence_emit(struct radeon_device *rdev, ...@@ -138,7 +138,7 @@ int radeon_fence_emit(struct radeon_device *rdev,
return -ENOMEM; return -ENOMEM;
} }
(*fence)->rdev = rdev; (*fence)->rdev = rdev;
(*fence)->seq = seq; (*fence)->seq = seq = ++rdev->fence_drv[ring].sync_seq[ring];
(*fence)->ring = ring; (*fence)->ring = ring;
(*fence)->is_vm_update = false; (*fence)->is_vm_update = false;
fence_init(&(*fence)->base, &radeon_fence_ops, fence_init(&(*fence)->base, &radeon_fence_ops,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment