Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/radeon: check return value of radeon_fence_emit

Function radeon_fence_emit() returns -ENOMEM if there is no enough
memory. And in this case, function radeon_ring_unlock_undo() rather than
function radeon_ring_unlock_commit() should be called. However, in
function radeon_test_create_and_emit_fence(), the return value of
radeon_fence_emit() is ignored. This patch adds the check.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Pan Bian and committed by
Alex Deucher
2f2429c3 c346fb74

+6 -1
+6 -1
drivers/gpu/drm/radeon/radeon_test.c
··· 298 298 DRM_ERROR("Failed to lock ring A %d\n", ring->idx); 299 299 return r; 300 300 } 301 - radeon_fence_emit(rdev, fence, ring->idx); 301 + r = radeon_fence_emit(rdev, fence, ring->idx); 302 + if (r) { 303 + DRM_ERROR("Failed to emit fence\n"); 304 + radeon_ring_unlock_undo(rdev, ring); 305 + return r; 306 + } 302 307 radeon_ring_unlock_commit(rdev, ring, false); 303 308 } 304 309 return 0;