aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/1157-drm-amd-dal-fix-issue-when-removing-sinks-where-arra.patch
blob: 1f528fb0cee259c6157463773beb677e37538f8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From 8a235154ebdda87c0bf8f2e53b9c1de556f39be0 Mon Sep 17 00:00:00 2001
From: Mykola Lysenko <Mykola.Lysenko@amd.com>
Date: Wed, 9 Dec 2015 19:20:12 +0800
Subject: [PATCH 1157/1565] drm/amd/dal: fix issue when removing sinks where
 array index is incorrect

Change-Id: Ib322c6a45ab4eabf5ac5ceb99715851675bc2c05
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland<harry.wentland@amd.com>
---
 drivers/gpu/drm/amd/dal/dc/core/dc_link.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
index e7a12e0..fe36786 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
@@ -357,10 +357,13 @@ static bool is_dp_active_dongle(enum display_dongle_type dongle_type)
 
 static void link_disconnect_all_sinks(struct core_link *link)
 {
-	int i;
-
-	for (i = 0; i < link->public.sink_count; i++)
-		dc_link_remove_sink(&link->public, link->public.sink[i]);
+	/*
+	 * as sink_count changed inside dc_link_remove_sink, we should not
+	 * use it for range check for loop, because half of sinks will not
+	 * be removed
+	 */
+	while (link->public.sink_count)
+		dc_link_remove_sink(&link->public, link->public.sink[0]);
 
 	link->dpcd_sink_count = 0;
 }
@@ -516,7 +519,9 @@ void dc_link_detect(const struct dc_link *dc_link)
 					 * ->sink = NULL
 					 * TODO: s3 resume check*/
 
-					if (dc_helpers_dp_mst_start_top_mgr(link->ctx, &link->public)) {
+					if (dc_helpers_dp_mst_start_top_mgr(
+						link->ctx,
+						&link->public)) {
 						return;
 					} else {
 						/* MST not supported */
-- 
1.9.1