drm/amdgpu: fix potential resource leak warning
authorjsg <jsg@openbsd.org>
Thu, 15 Aug 2024 02:51:35 +0000 (02:51 +0000)
committerjsg <jsg@openbsd.org>
Thu, 15 Aug 2024 02:51:35 +0000 (02:51 +0000)
From Tim Huang
bc93cfde69b7c786fcdc70463e153fdf633caff9 in linux-6.6.y/6.6.46
22a5daaec0660dd19740c4c6608b78f38760d1e6 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_vm_sdma.c

index 349416e..1cf1498 100644 (file)
@@ -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;
 }