drm/amd/display: reset transfer_func to NULL on release
authorYongqiang Sun <yongqiang.sun@amd.com>
Wed, 21 Dec 2016 16:13:48 +0000 (11:13 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 21:06:58 +0000 (17:06 -0400)
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>
drivers/gpu/drm/amd/display/dc/core/dc_stream.c
drivers/gpu/drm/amd/display/dc/core/dc_surface.c

index 237436e22720dc8ade56335c4e667500d05fdaf0..84e3fbbe23ac38e167a255ff4bd8676e94af66f1 100644 (file)
@@ -89,9 +89,11 @@ static bool construct(struct core_stream *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)
index 3ec1f363e43e28d7573649a5be9c59059989382f..cf8fb9a8ce8eafd7f91ce0d59295f86d70e75326 100644 (file)
@@ -71,11 +71,15 @@ static bool construct(struct dc_context *ctx, struct surface *surface)
 
 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;
+       }
 }
 
 /*******************************************************************************