aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
diff options
context:
space:
mode:
authorTim Huang <[email protected]>2024-04-25 03:09:00 +0000
committerAlex Deucher <[email protected]>2024-04-30 13:58:53 +0000
commit22a5daaec0660dd19740c4c6608b78f38760d1e6 (patch)
tree7281a27757b02ebcc176bdfc289deb46ea5e8358 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
parentdrm/amdgpu: avoid dump mca bank log muti times during ras ISR (diff)
downloadkernel-22a5daaec0660dd19740c4c6608b78f38760d1e6.tar.gz
kernel-22a5daaec0660dd19740c4c6608b78f38760d1e6.zip
drm/amdgpu: fix potential resource leak warning
Clear resource leak warning that when the prepare fails, the allocated amdgpu job object will never be released. Signed-off-by: Tim Huang <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
index 66e8a016126b..9b748d7058b5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
@@ -102,6 +102,11 @@ static int amdgpu_vm_sdma_prepare(struct amdgpu_vm_update_params *p,
if (!r)
r = amdgpu_sync_push_to_job(&sync, p->job);
amdgpu_sync_free(&sync);
+
+ if (r) {
+ p->num_dw_left = 0;
+ amdgpu_job_free(p->job);
+ }
return r;
}