Skip to content

Commit b24c683

Browse files
nhaehnlealexdeucher
authored andcommitted
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: Michel Dänzer <[email protected]> Signed-off-by: Nicolai Hähnle <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 5fc4539 commit b24c683

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/radeon/radeon_fence.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ int radeon_fence_emit(struct radeon_device *rdev,
130130
struct radeon_fence **fence,
131131
int ring)
132132
{
133-
u64 seq = ++rdev->fence_drv[ring].sync_seq[ring];
133+
u64 seq;
134134

135135
/* we are protected by the ring emission mutex */
136136
*fence = kmalloc(sizeof(struct radeon_fence), GFP_KERNEL);
137137
if ((*fence) == NULL) {
138138
return -ENOMEM;
139139
}
140140
(*fence)->rdev = rdev;
141-
(*fence)->seq = seq;
141+
(*fence)->seq = seq = ++rdev->fence_drv[ring].sync_seq[ring];
142142
(*fence)->ring = ring;
143143
(*fence)->is_vm_update = false;
144144
fence_init(&(*fence)->base, &radeon_fence_ops,

0 commit comments

Comments
 (0)