--- a/sys/dev/drm/amd/amdgpu/amdgpu_test.c +++ b/sys/dev/drm/amd/amdgpu/amdgpu_test.c @@ -233,6 +233,19 @@ break; } + /* + * Release the GTT test objects on the success path too. The error + * unwind above has already unreffed (and NULLed) every slot it + * touched, so the guard makes this a no-op there. + */ + for (i = n - 1; i >= 0; i--) { + if (gtt_obj[i]) { + amdgpu_bo_unpin(gtt_obj[i]); + amdgpu_bo_unreserve(gtt_obj[i]); + amdgpu_bo_unref(>t_obj[i]); + } + } + amdgpu_bo_unpin(vram_obj); out_unres: amdgpu_bo_unreserve(vram_obj);