From 0e45b09c8a813c15d96701c3daa5436cc358111f Mon Sep 17 00:00:00 2001 From: Eric Yang Date: Fri, 1 Apr 2016 18:38:34 -0400 Subject: [PATCH 1000/1110] drm/amd/dal: handle the case we cannot restore connector state If we unplug the last display and plug in a different one that does not support the timing set on the previous display, we can fail in dc_commit_targets, this was not properly handled and was causing a crash Signed-off-by: Eric Yang Acked-by: Harry Wentland --- drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c index d2548b6..0e19f8d 100644 --- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c +++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c @@ -2412,7 +2412,14 @@ void dm_restore_drm_connector_state(struct drm_device *dev, struct drm_connector } /* DC is optimized not to do anything if 'targets' didn't change. */ - dc_commit_targets(dc, commit_targets, commit_targets_count); + if (!dc_commit_targets(dc, commit_targets, + commit_targets_count)) { + DRM_INFO("Failed to restore connector state!\n"); + dc_target_release(disconnected_acrtc->target); + disconnected_acrtc->target = NULL; + disconnected_acrtc->enabled = false; + return; + } dm_dc_surface_commit(dc, &disconnected_acrtc->base, -- 2.7.4