From 769897c0f051318797a0d79e66a9dc5136c4714c Mon Sep 17 00:00:00 2001 From: "Leo (Sunpeng) Li" Date: Wed, 16 May 2018 16:25:51 -0400 Subject: [PATCH] drm/amd/display: Fix null pointer when configuring color management For cases where the CRTC is inactive (DPMS off), where a modeset is not required, yet the CRTC is still in the atomic state, we should not attempt to configure color management on it. Previously, we were relying on the modereset_required() helper to check the above condition. However, the function returns false if a modeset is not required. The correct way to check is by looking at the enable and active flags on the CRTC. Change-Id: I83f52a6c64a4937c32e9307e26e437c7042b5cf9 Signed-off-by: Leo (Sunpeng) Li --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index b80d213..ab7548e 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4823,7 +4823,8 @@ static int dm_update_crtcs_state(struct amdgpu_display_manager *dm, * We want to do dc stream updates that do not require a * full modeset below. */ - if (!enable || !aconnector || modereset_required(new_crtc_state)) + if (!(enable && aconnector && new_crtc_state->enable && + new_crtc_state->active)) continue; /* * Given above conditions, the dc state cannot be NULL because: -- 2.7.4