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

drm/amdgpu: fix uvd fini mem leak

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Monk Liu and committed by
Alex Deucher
05f19eb5 e517cd77

+10 -9
+10 -9
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
··· 253 253 { 254 254 int r; 255 255 256 - if (adev->uvd.vcpu_bo == NULL) 257 - return 0; 256 + kfree(adev->uvd.saved_bo); 258 257 259 258 amd_sched_entity_fini(&adev->uvd.ring.sched, &adev->uvd.entity); 260 259 261 - r = amdgpu_bo_reserve(adev->uvd.vcpu_bo, false); 262 - if (!r) { 263 - amdgpu_bo_kunmap(adev->uvd.vcpu_bo); 264 - amdgpu_bo_unpin(adev->uvd.vcpu_bo); 265 - amdgpu_bo_unreserve(adev->uvd.vcpu_bo); 266 - } 260 + if (adev->uvd.vcpu_bo) { 261 + r = amdgpu_bo_reserve(adev->uvd.vcpu_bo, false); 262 + if (!r) { 263 + amdgpu_bo_kunmap(adev->uvd.vcpu_bo); 264 + amdgpu_bo_unpin(adev->uvd.vcpu_bo); 265 + amdgpu_bo_unreserve(adev->uvd.vcpu_bo); 266 + } 267 267 268 - amdgpu_bo_unref(&adev->uvd.vcpu_bo); 268 + amdgpu_bo_unref(&adev->uvd.vcpu_bo); 269 + } 269 270 270 271 amdgpu_ring_fini(&adev->uvd.ring); 271 272