Blob Blame History Raw
From: Yongqiang Sun <yongqiang.sun@amd.com>
Date: Wed, 21 Dec 2016 11:13:48 -0500
Subject: drm/amd/display: reset transfer_func to NULL on release
Git-commit: 80bd20967261d9438dc814f3e6e904aea053163b
Patch-mainline: v4.15-rc1
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c  |    4 +++-
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c |    8 ++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -89,9 +89,11 @@ static bool construct(struct core_stream
 static void destruct(struct core_stream *stream)
 {
 	dc_sink_release(&stream->sink->public);
-	if (stream->public.out_transfer_func != NULL)
+	if (stream->public.out_transfer_func != NULL) {
 		dc_transfer_func_release(
 				stream->public.out_transfer_func);
+		stream->public.out_transfer_func = NULL;
+	}
 }
 
 void dc_stream_retain(const struct dc_stream *dc_stream)
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -71,11 +71,15 @@ static bool construct(struct dc_context
 
 static void destruct(struct surface *surface)
 {
-	if (surface->protected.public.gamma_correction != NULL)
+	if (surface->protected.public.gamma_correction != NULL) {
 		dc_gamma_release(surface->protected.public.gamma_correction);
-	if (surface->protected.public.in_transfer_func != NULL)
+		surface->protected.public.gamma_correction = NULL;
+	}
+	if (surface->protected.public.in_transfer_func != NULL) {
 		dc_transfer_func_release(
 				surface->protected.public.in_transfer_func);
+		surface->protected.public.in_transfer_func = NULL;
+	}
 }
 
 /*******************************************************************************