summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/display/dc/dce/dce_opp.c
diff options
context:
space:
mode:
authorJoshua Aberback <Joshua.Aberback@amd.com>2017-01-18 00:01:35 +0300
committerAlex Deucher <alexander.deucher@amd.com>2017-09-27 00:11:42 +0300
commit4d35b093e635de739d0bdcbb57244424cb1abb61 (patch)
tree34be11212c3e69c11035075ddef2bf08a84cb74c /drivers/gpu/drm/amd/display/dc/dce/dce_opp.c
parent9c1a57d79dbc96e808ea81aa1385f2d9d03570a0 (diff)
downloadlinux-4d35b093e635de739d0bdcbb57244424cb1abb61.tar.xz
drm/amd/display: Proper de-allocation of OPP
- refactor opp_destroy functions to dce common file - fixes memory leak, dce specific variations didn't free regamma_params - remove unused dce110_regamma structure Signed-off-by: Joshua Aberback <Joshua.Aberback@amd.com> Reviewed-by: Jun Lei <Jun.Lei@amd.com> Acked-by: Harry Wentland <Harry.Wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/dce/dce_opp.c')
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce/dce_opp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_opp.c b/drivers/gpu/drm/amd/display/dc/dce/dce_opp.c
index 061de9e8249d..62f01911639f 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_opp.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_opp.c
@@ -986,10 +986,12 @@ bool dce110_opp_construct(struct dce110_opp *opp110,
void dce110_opp_destroy(struct output_pixel_processor **opp)
{
- dm_free((*opp)->regamma_params);
- (*opp)->regamma_params = NULL;
-
- dm_free(FROM_DCE11_OPP(*opp));
+ if (*opp) {
+ if ((*opp)->regamma_params)
+ dm_free((*opp)->regamma_params);
+ (*opp)->regamma_params = NULL;
+ dm_free(FROM_DCE11_OPP(*opp));
+ }
*opp = NULL;
}