[PATCH 04/22] drm/amd: fix the warning unchecking return vaule for sdma_v7

Jesse Zhang jesse.zhang at amd.com
Fri May 10 02:50:20 UTC 2024


check ring allocate success before emit preempt ib

Signed-off-by: Jesse Zhang <Jesse.Zhang at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
index 0b5af1c50461..7db53a96cff0 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
@@ -1347,7 +1347,11 @@ static int sdma_v7_0_ring_preempt_ib(struct amdgpu_ring *ring)
 
 	/* emit the trailing fence */
 	ring->trail_seq += 1;
-	amdgpu_ring_alloc(ring, 10);
+	r = amdgpu_ring_alloc(ring, 10);
+	if (r) {
+		DRM_ERROR("ring %d failed to be allocated \n", ring->idx);
+		return r;
+	}
 	sdma_v7_0_ring_emit_fence(ring, ring->trail_fence_gpu_addr,
 				  ring->trail_seq, 0);
 	amdgpu_ring_commit(ring);
-- 
2.25.1



More information about the amd-gfx mailing list