summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/display
diff options
context:
space:
mode:
authorJerry (Fangzhi) Zuo <Jerry.Zuo@amd.com>2018-11-27 18:51:12 +0300
committerAlex Deucher <alexander.deucher@amd.com>2018-11-29 22:42:28 +0300
commit58124bf8f4a6ee4c91845d3b48712e1ee8876bdc (patch)
tree3436a3bf9fe98ebf25440849451e4b5f105e0aef /drivers/gpu/drm/amd/display
parent8b955e00d4a56a36763e9349a78483515560a3ca (diff)
downloadlinux-58124bf8f4a6ee4c91845d3b48712e1ee8876bdc.tar.xz
drm/amd/display: Fix NULL ptr when calculating refresh rate
Calculate preferred refresh rate only when preferred mode exists. Signed-off-by: Jerry (Fangzhi) Zuo <Jerry.Zuo@amd.com> Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display')
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c5
1 files changed, 2 insertions, 3 deletions
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 ce00e56814ed..c791003c8133 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2848,7 +2848,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
bool native_mode_found = false;
bool scale = dm_state ? (dm_state->scaling != RMX_OFF) : false;
int mode_refresh;
- int preferred_refresh;
+ int preferred_refresh = 0;
struct dc_sink *sink = NULL;
if (aconnector == NULL) {
@@ -2902,13 +2902,12 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
decide_crtc_timing_for_drm_display_mode(
&mode, preferred_mode,
dm_state ? (dm_state->scaling != RMX_OFF) : false);
+ preferred_refresh = drm_mode_vrefresh(preferred_mode);
}
if (!dm_state)
drm_mode_set_crtcinfo(&mode, 0);
- preferred_refresh = drm_mode_vrefresh(preferred_mode);
-
/*
* If scaling is enabled and refresh rate didn't change
* we copy the vic and polarities of the old timings