Commit 9d8f086c authored by Monk Liu's avatar Monk Liu Committed by Alex Deucher

drm/amdgpu: fix memleak in pptable_init

Signed-off-by: default avatarMonk Liu <Monk.Liu@amd.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 89e0ec9f
...@@ -73,11 +73,14 @@ static int pp_sw_init(void *handle) ...@@ -73,11 +73,14 @@ static int pp_sw_init(void *handle)
ret = hwmgr->hwmgr_func->backend_init(hwmgr); ret = hwmgr->hwmgr_func->backend_init(hwmgr);
if (ret) if (ret)
goto err; goto err1;
pr_info("amdgpu: powerplay initialized\n"); pr_info("amdgpu: powerplay initialized\n");
return 0; return 0;
err1:
if (hwmgr->pptable_func->pptable_fini)
hwmgr->pptable_func->pptable_fini(hwmgr);
err: err:
pr_err("amdgpu: powerplay initialization failed\n"); pr_err("amdgpu: powerplay initialization failed\n");
return ret; return ret;
...@@ -100,6 +103,9 @@ static int pp_sw_fini(void *handle) ...@@ -100,6 +103,9 @@ static int pp_sw_fini(void *handle)
if (hwmgr->hwmgr_func->backend_fini != NULL) if (hwmgr->hwmgr_func->backend_fini != NULL)
ret = hwmgr->hwmgr_func->backend_fini(hwmgr); ret = hwmgr->hwmgr_func->backend_fini(hwmgr);
if (hwmgr->pptable_func->pptable_fini)
hwmgr->pptable_func->pptable_fini(hwmgr);
return ret; return ret;
} }
......
...@@ -1040,48 +1040,44 @@ int tonga_pp_tables_uninitialize(struct pp_hwmgr *hwmgr) ...@@ -1040,48 +1040,44 @@ int tonga_pp_tables_uninitialize(struct pp_hwmgr *hwmgr)
struct phm_ppt_v1_information *pp_table_information = struct phm_ppt_v1_information *pp_table_information =
(struct phm_ppt_v1_information *)(hwmgr->pptable); (struct phm_ppt_v1_information *)(hwmgr->pptable);
if (NULL != hwmgr->soft_pp_table) { if (NULL != hwmgr->soft_pp_table)
kfree(hwmgr->soft_pp_table);
hwmgr->soft_pp_table = NULL; hwmgr->soft_pp_table = NULL;
}
if (NULL != pp_table_information->vdd_dep_on_sclk) kfree(pp_table_information->vdd_dep_on_sclk);
pp_table_information->vdd_dep_on_sclk = NULL; pp_table_information->vdd_dep_on_sclk = NULL;
if (NULL != pp_table_information->vdd_dep_on_mclk) kfree(pp_table_information->vdd_dep_on_mclk);
pp_table_information->vdd_dep_on_mclk = NULL; pp_table_information->vdd_dep_on_mclk = NULL;
if (NULL != pp_table_information->valid_mclk_values) kfree(pp_table_information->valid_mclk_values);
pp_table_information->valid_mclk_values = NULL; pp_table_information->valid_mclk_values = NULL;
if (NULL != pp_table_information->valid_sclk_values) kfree(pp_table_information->valid_sclk_values);
pp_table_information->valid_sclk_values = NULL; pp_table_information->valid_sclk_values = NULL;
if (NULL != pp_table_information->vddc_lookup_table) kfree(pp_table_information->vddc_lookup_table);
pp_table_information->vddc_lookup_table = NULL; pp_table_information->vddc_lookup_table = NULL;
if (NULL != pp_table_information->vddgfx_lookup_table) kfree(pp_table_information->vddgfx_lookup_table);
pp_table_information->vddgfx_lookup_table = NULL; pp_table_information->vddgfx_lookup_table = NULL;
if (NULL != pp_table_information->mm_dep_table) kfree(pp_table_information->mm_dep_table);
pp_table_information->mm_dep_table = NULL; pp_table_information->mm_dep_table = NULL;
if (NULL != pp_table_information->cac_dtp_table) kfree(pp_table_information->cac_dtp_table);
pp_table_information->cac_dtp_table = NULL; pp_table_information->cac_dtp_table = NULL;
if (NULL != hwmgr->dyn_state.cac_dtp_table) kfree(hwmgr->dyn_state.cac_dtp_table);
hwmgr->dyn_state.cac_dtp_table = NULL; hwmgr->dyn_state.cac_dtp_table = NULL;
if (NULL != pp_table_information->ppm_parameter_table) kfree(pp_table_information->ppm_parameter_table);
pp_table_information->ppm_parameter_table = NULL; pp_table_information->ppm_parameter_table = NULL;
if (NULL != pp_table_information->pcie_table) kfree(pp_table_information->pcie_table);
pp_table_information->pcie_table = NULL; pp_table_information->pcie_table = NULL;
if (NULL != hwmgr->pptable) { kfree(hwmgr->pptable);
kfree(hwmgr->pptable); hwmgr->pptable = NULL;
hwmgr->pptable = NULL;
}
return result; return result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment