drm/amd/display: Fix memory leak caused by missed dc_sink_release
authorSivapiriyanKumarasamy <sivapiriyan.kumarasamy@amd.com>
Wed, 15 Aug 2018 20:55:18 +0000 (16:55 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 27 Aug 2018 20:20:31 +0000 (15:20 -0500)
[Why]
There is currently an intermittent hang from a memory leak in
DTN stress testing. It is caused by unfreed memory during driver
disable.

[How]
Do a dc_sink_release in the case that skips it incorrectly.

Signed-off-by: SivapiriyanKumarasamy <sivapiriyan.kumarasamy@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link.c

index 309059871706ed029412cbc2ba6ffd9af115cf1c..9d8dc2c1ca65eff829ad42dc0dc7cefe18bb35a1 100644 (file)
@@ -772,8 +772,12 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
                         * fail-safe mode
                         */
                        if (dc_is_hdmi_signal(link->connector_signal) ||
-                           dc_is_dvi_signal(link->connector_signal))
+                           dc_is_dvi_signal(link->connector_signal)) {
+                               if (prev_sink != NULL)
+                                       dc_sink_release(prev_sink);
+
                                return false;
+                       }
                default:
                        break;
                }