[PATCH] drm/amd/display: Fix NULL ptr when calculating refresh rate

Lakha, Bhawanpreet Bhawanpreet.Lakha at amd.com
Tue Nov 27 19:01:05 UTC 2018


Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha at amd.com>

________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Jerry (Fangzhi) Zuo <Jerry.Zuo at amd.com>
Sent: November 27, 2018 1:45:54 PM
To: amd-gfx at lists.freedesktop.org; Wentland, Harry; Lakha, Bhawanpreet
Cc: Zuo, Jerry
Subject: [PATCH] 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 at amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ++---
 1 file 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 27df3ae945be..3039faf004a8 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2835,7 +2835,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) {
@@ -2889,13 +2889,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
--
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20181127/93345a26/attachment.html>


More information about the amd-gfx mailing list