The job might already be freed up here. So cache the pasid for later
use.

Signed-off-by: Christian König <[email protected]>
Suggested-by: Philipp Stanner <[email protected]>
Fixes: a72002cb181f ("drm/amdgpu: Make use of drm_wedge_task_info")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 654f4844b7ad..84bb89498e12 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -6506,8 +6506,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
        struct list_head device_list;
        bool job_signaled = false;
        struct amdgpu_hive_info *hive = NULL;
-       int r = 0;
        bool need_emergency_restart = false;
+       unsigned int pasid = job->pasid;
+       int r = 0;
 
        /*
         * If it reaches here because of hang/timeout and a RAS error is
@@ -6605,7 +6606,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
                struct amdgpu_task_info *ti = NULL;
 
                if (job)
-                       ti = amdgpu_vm_get_task_info_pasid(adev, job->pasid);
+                       ti = amdgpu_vm_get_task_info_pasid(adev, pasid);
 
                drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE,
                                     ti ? &ti->task : NULL);
-- 
2.43.0

Reply via email to