aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/1002-drm-amd-dal-fix-target-duplication-during-target-res.patch
blob: db63a0754eaaee65961d05b62145e2e38fcfbe18 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From 498fe7891c7983dee32ccfc3ba6c8d0720717636 Mon Sep 17 00:00:00 2001
From: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Date: Mon, 4 Apr 2016 17:05:54 -0400
Subject: [PATCH 1002/1110] drm/amd/dal: fix target duplication during target
 reset

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c | 17 ++++++++---------
 drivers/gpu/drm/amd/dal/dc/core/dc_surface.c        |  1 +
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
index 0e19f8d..a21d634 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
@@ -2481,25 +2481,24 @@ static uint32_t remove_from_val_sets(
 	uint32_t set_count,
 	const struct dc_target *target)
 {
-	uint32_t i = 0;
+	int i;
 
-	while (i < set_count) {
+	for (i = 0; i < set_count; i++)
 		if (val_sets[i].target == target)
 			break;
-		++i;
-	}
 
 	if (i == set_count) {
 		/* nothing found */
 		return set_count;
 	}
 
-	memmove(
-		&val_sets[i],
-		&val_sets[i + 1],
-		sizeof(struct dc_validation_set *) * (set_count - i - 1));
+	set_count--;
+
+	for (; i < set_count; i++) {
+		val_sets[i] = val_sets[i + 1];
+	}
 
-	return set_count - 1;
+	return set_count;
 }
 
 int amdgpu_dm_atomic_check(struct drm_device *dev,
diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_surface.c b/drivers/gpu/drm/amd/dal/dc/core/dc_surface.c
index 5c586ba..d688bc2 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_surface.c
@@ -112,6 +112,7 @@ void dc_surface_retain(const struct dc_surface *dc_surface)
 void dc_surface_release(const struct dc_surface *dc_surface)
 {
 	struct surface *surface = DC_SURFACE_TO_SURFACE(dc_surface);
+
 	--surface->ref_count;
 
 	if (surface->ref_count == 0) {
-- 
2.7.4