提交 8f8033d5 编写于 作者: R Rafael Mendonca 提交者: Alex Deucher

drm/amdgpu/powerplay/psm: Fix memory leak in power state init

Commit 902bc65d ("drm/amdgpu/powerplay/psm: return an error in power
state init") made the power state init function return early in case of
failure to get an entry from the powerplay table, but it missed to clean up
the allocated memory for the current power state before returning.

Fixes: 902bc65d ("drm/amdgpu/powerplay/psm: return an error in power state init")
Reviewed-by: NEvan Quan <evan.quan@amd.com>
Signed-off-by: NRafael Mendonca <rafaelmendsr@gmail.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 df768a97
...@@ -75,8 +75,10 @@ int psm_init_power_state_table(struct pp_hwmgr *hwmgr) ...@@ -75,8 +75,10 @@ int psm_init_power_state_table(struct pp_hwmgr *hwmgr)
for (i = 0; i < table_entries; i++) { for (i = 0; i < table_entries; i++) {
result = hwmgr->hwmgr_func->get_pp_table_entry(hwmgr, i, state); result = hwmgr->hwmgr_func->get_pp_table_entry(hwmgr, i, state);
if (result) { if (result) {
kfree(hwmgr->current_ps);
kfree(hwmgr->request_ps); kfree(hwmgr->request_ps);
kfree(hwmgr->ps); kfree(hwmgr->ps);
hwmgr->current_ps = NULL;
hwmgr->request_ps = NULL; hwmgr->request_ps = NULL;
hwmgr->ps = NULL; hwmgr->ps = NULL;
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册