aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0360-drm-amd-display-Fix-memory-leak-in-post_update_surfa.patch
blob: 6ac81dc83265c9bd578ffcc29abe69591ee95b4e (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
From b20c15581722ce04abc82974cb95e0721af53896 Mon Sep 17 00:00:00 2001
From: Harry Wentland <harry.wentland@amd.com>
Date: Tue, 18 Apr 2017 15:43:22 -0400
Subject: [PATCH 0360/4131] drm/amd/display: Fix memory leak in
 post_update_surfaces

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 64b5216..b1f0a50 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -918,6 +918,7 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
 	int i;
 	struct core_dc *core_dc = DC_TO_CORE(dc);
 	struct validate_context *context = dm_alloc(sizeof(struct validate_context));
+	bool result = true;
 
 	if (!context) {
 		dm_error("%s: failed to create validate ctx\n", __func__);
@@ -935,17 +936,19 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
 
 	if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) {
 		BREAK_TO_DEBUGGER();
-		return false;
+		result = false;
+		goto cleanup;
 	}
 
 	core_dc->hwss.set_bandwidth(core_dc, context, true);
 
 	dc_resource_validate_ctx_copy_construct(context, core_dc->current_context);
 
+cleanup:
 	dc_resource_validate_ctx_destruct(context);
 	dm_free(context);
 
-	return true;
+	return result;
 }
 
 bool dc_commit_surfaces_to_stream(
-- 
2.7.4