Commit 55611b50 authored by Jack Xiao's avatar Jack Xiao Committed by Alex Deucher

drm/amdgpu: avoid dereferencing a NULL pointer

Check if irq_src is NULL to avoid dereferencing a NULL pointer,
for MES ring is uneccessary to recieve an interrupt notification.
Signed-off-by: default avatarJack Xiao <Jack.Xiao@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent cdca7979
...@@ -416,7 +416,9 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, ...@@ -416,7 +416,9 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
ring->fence_drv.gpu_addr = adev->uvd.inst[ring->me].gpu_addr + index; ring->fence_drv.gpu_addr = adev->uvd.inst[ring->me].gpu_addr + index;
} }
amdgpu_fence_write(ring, atomic_read(&ring->fence_drv.last_seq)); amdgpu_fence_write(ring, atomic_read(&ring->fence_drv.last_seq));
amdgpu_irq_get(adev, irq_src, irq_type);
if (irq_src)
amdgpu_irq_get(adev, irq_src, irq_type);
ring->fence_drv.irq_src = irq_src; ring->fence_drv.irq_src = irq_src;
ring->fence_drv.irq_type = irq_type; ring->fence_drv.irq_type = irq_type;
...@@ -537,8 +539,9 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) ...@@ -537,8 +539,9 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev)
/* no need to trigger GPU reset as we are unloading */ /* no need to trigger GPU reset as we are unloading */
amdgpu_fence_driver_force_completion(ring); amdgpu_fence_driver_force_completion(ring);
} }
amdgpu_irq_put(adev, ring->fence_drv.irq_src, if (ring->fence_drv.irq_src)
ring->fence_drv.irq_type); amdgpu_irq_put(adev, ring->fence_drv.irq_src,
ring->fence_drv.irq_type);
drm_sched_fini(&ring->sched); drm_sched_fini(&ring->sched);
del_timer_sync(&ring->fence_drv.fallback_timer); del_timer_sync(&ring->fence_drv.fallback_timer);
for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j) for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j)
...@@ -574,8 +577,9 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev) ...@@ -574,8 +577,9 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev)
} }
/* disable the interrupt */ /* disable the interrupt */
amdgpu_irq_put(adev, ring->fence_drv.irq_src, if (ring->fence_drv.irq_src)
ring->fence_drv.irq_type); amdgpu_irq_put(adev, ring->fence_drv.irq_src,
ring->fence_drv.irq_type);
} }
} }
...@@ -601,8 +605,9 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev) ...@@ -601,8 +605,9 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev)
continue; continue;
/* enable the interrupt */ /* enable the interrupt */
amdgpu_irq_get(adev, ring->fence_drv.irq_src, if (ring->fence_drv.irq_src)
ring->fence_drv.irq_type); amdgpu_irq_get(adev, ring->fence_drv.irq_src,
ring->fence_drv.irq_type);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment