Commit 80285ae1 authored by Stanley.Yang's avatar Stanley.Yang Committed by Alex Deucher
Browse files

drm/amdgpu: Fix potential null pointer derefernce



The amdgpu_ras_get_context may return NULL if device
not support ras feature, so add check before using.

Signed-off-by: default avatarStanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: default avatarTao Zhou <tao.zhou1@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 098c1307
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -5438,7 +5438,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
	 * Flush RAM to disk so that after reboot
	 * the user can read log and see why the system rebooted.
	 */
	if (need_emergency_restart && amdgpu_ras_get_context(adev)->reboot) {
	if (need_emergency_restart && amdgpu_ras_get_context(adev) &&
		amdgpu_ras_get_context(adev)->reboot) {
		DRM_WARN("Emergency reboot.");

		ksys_sync_helper();