Skip to content

Commit

Permalink
drm/radeon: only increment sync_seq when a fence is really emitted
Browse files Browse the repository at this point in the history
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: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Nicolai Hähnle <Nicolai.Haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Nicolai Hähnle authored and Alex Deucher committed Dec 18, 2015
1 parent 5fc4539 commit b24c683
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/radeon/radeon_fence.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ int radeon_fence_emit(struct radeon_device *rdev,
struct radeon_fence **fence,
int ring)
{
u64 seq = ++rdev->fence_drv[ring].sync_seq[ring];
u64 seq;

/* we are protected by the ring emission mutex */
*fence = kmalloc(sizeof(struct radeon_fence), GFP_KERNEL);
if ((*fence) == NULL) {
return -ENOMEM;
}
(*fence)->rdev = rdev;
(*fence)->seq = seq;
(*fence)->seq = seq = ++rdev->fence_drv[ring].sync_seq[ring];
(*fence)->ring = ring;
(*fence)->is_vm_update = false;
fence_init(&(*fence)->base, &radeon_fence_ops,
Expand Down

0 comments on commit b24c683

Please sign in to comment.