diff options
author | Monk Liu <Monk.Liu@amd.com> | 2016-05-30 01:43:45 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-06-09 10:49:04 -0400 |
commit | 9d8f086cd05954e03f10db1a9a52a240d086dc8c (patch) | |
tree | ce0e601b055a10510195f4201952ec2f41af9c6c /drivers | |
parent | 89e0ec9f5e27a8c5b5954290bef703dc6aac44f3 (diff) |
drm/amdgpu: fix memleak in pptable_init
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | 54 |
2 files changed, 32 insertions, 30 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index 8e345bfddb69..e629f8a9fe93 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c | |||
@@ -73,11 +73,14 @@ static int pp_sw_init(void *handle) | |||
73 | 73 | ||
74 | ret = hwmgr->hwmgr_func->backend_init(hwmgr); | 74 | ret = hwmgr->hwmgr_func->backend_init(hwmgr); |
75 | if (ret) | 75 | if (ret) |
76 | goto err; | 76 | goto err1; |
77 | 77 | ||
78 | pr_info("amdgpu: powerplay initialized\n"); | 78 | pr_info("amdgpu: powerplay initialized\n"); |
79 | 79 | ||
80 | return 0; | 80 | return 0; |
81 | err1: | ||
82 | if (hwmgr->pptable_func->pptable_fini) | ||
83 | hwmgr->pptable_func->pptable_fini(hwmgr); | ||
81 | err: | 84 | err: |
82 | pr_err("amdgpu: powerplay initialization failed\n"); | 85 | pr_err("amdgpu: powerplay initialization failed\n"); |
83 | return ret; | 86 | return ret; |
@@ -100,6 +103,9 @@ static int pp_sw_fini(void *handle) | |||
100 | if (hwmgr->hwmgr_func->backend_fini != NULL) | 103 | if (hwmgr->hwmgr_func->backend_fini != NULL) |
101 | ret = hwmgr->hwmgr_func->backend_fini(hwmgr); | 104 | ret = hwmgr->hwmgr_func->backend_fini(hwmgr); |
102 | 105 | ||
106 | if (hwmgr->pptable_func->pptable_fini) | ||
107 | hwmgr->pptable_func->pptable_fini(hwmgr); | ||
108 | |||
103 | return ret; | 109 | return ret; |
104 | } | 110 | } |
105 | 111 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c index 10e3630ee39d..296ec7ef6d45 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | |||
@@ -1040,48 +1040,44 @@ int tonga_pp_tables_uninitialize(struct pp_hwmgr *hwmgr) | |||
1040 | struct phm_ppt_v1_information *pp_table_information = | 1040 | struct phm_ppt_v1_information *pp_table_information = |
1041 | (struct phm_ppt_v1_information *)(hwmgr->pptable); | 1041 | (struct phm_ppt_v1_information *)(hwmgr->pptable); |
1042 | 1042 | ||
1043 | if (NULL != hwmgr->soft_pp_table) { | 1043 | if (NULL != hwmgr->soft_pp_table) |
1044 | kfree(hwmgr->soft_pp_table); | ||
1045 | hwmgr->soft_pp_table = NULL; | 1044 | hwmgr->soft_pp_table = NULL; |
1046 | } | ||
1047 | 1045 | ||
1048 | if (NULL != pp_table_information->vdd_dep_on_sclk) | 1046 | kfree(pp_table_information->vdd_dep_on_sclk); |
1049 | pp_table_information->vdd_dep_on_sclk = NULL; | 1047 | pp_table_information->vdd_dep_on_sclk = NULL; |
1050 | 1048 | ||
1051 | if (NULL != pp_table_information->vdd_dep_on_mclk) | 1049 | kfree(pp_table_information->vdd_dep_on_mclk); |
1052 | pp_table_information->vdd_dep_on_mclk = NULL; | 1050 | pp_table_information->vdd_dep_on_mclk = NULL; |
1053 | 1051 | ||
1054 | if (NULL != pp_table_information->valid_mclk_values) | 1052 | kfree(pp_table_information->valid_mclk_values); |
1055 | pp_table_information->valid_mclk_values = NULL; | 1053 | pp_table_information->valid_mclk_values = NULL; |
1056 | 1054 | ||
1057 | if (NULL != pp_table_information->valid_sclk_values) | 1055 | kfree(pp_table_information->valid_sclk_values); |
1058 | pp_table_information->valid_sclk_values = NULL; | 1056 | pp_table_information->valid_sclk_values = NULL; |
1059 | 1057 | ||
1060 | if (NULL != pp_table_information->vddc_lookup_table) | 1058 | kfree(pp_table_information->vddc_lookup_table); |
1061 | pp_table_information->vddc_lookup_table = NULL; | 1059 | pp_table_information->vddc_lookup_table = NULL; |
1062 | 1060 | ||
1063 | if (NULL != pp_table_information->vddgfx_lookup_table) | 1061 | kfree(pp_table_information->vddgfx_lookup_table); |
1064 | pp_table_information->vddgfx_lookup_table = NULL; | 1062 | pp_table_information->vddgfx_lookup_table = NULL; |
1065 | 1063 | ||
1066 | if (NULL != pp_table_information->mm_dep_table) | 1064 | kfree(pp_table_information->mm_dep_table); |
1067 | pp_table_information->mm_dep_table = NULL; | 1065 | pp_table_information->mm_dep_table = NULL; |
1068 | 1066 | ||
1069 | if (NULL != pp_table_information->cac_dtp_table) | 1067 | kfree(pp_table_information->cac_dtp_table); |
1070 | pp_table_information->cac_dtp_table = NULL; | 1068 | pp_table_information->cac_dtp_table = NULL; |
1071 | 1069 | ||
1072 | if (NULL != hwmgr->dyn_state.cac_dtp_table) | 1070 | kfree(hwmgr->dyn_state.cac_dtp_table); |
1073 | hwmgr->dyn_state.cac_dtp_table = NULL; | 1071 | hwmgr->dyn_state.cac_dtp_table = NULL; |
1074 | 1072 | ||
1075 | if (NULL != pp_table_information->ppm_parameter_table) | 1073 | kfree(pp_table_information->ppm_parameter_table); |
1076 | pp_table_information->ppm_parameter_table = NULL; | 1074 | pp_table_information->ppm_parameter_table = NULL; |
1077 | 1075 | ||
1078 | if (NULL != pp_table_information->pcie_table) | 1076 | kfree(pp_table_information->pcie_table); |
1079 | pp_table_information->pcie_table = NULL; | 1077 | pp_table_information->pcie_table = NULL; |
1080 | 1078 | ||
1081 | if (NULL != hwmgr->pptable) { | 1079 | kfree(hwmgr->pptable); |
1082 | kfree(hwmgr->pptable); | 1080 | hwmgr->pptable = NULL; |
1083 | hwmgr->pptable = NULL; | ||
1084 | } | ||
1085 | 1081 | ||
1086 | return result; | 1082 | return result; |
1087 | } | 1083 | } |