Commit 2f3be3ca authored by Zhipeng Lu's avatar Zhipeng Lu Committed by Alex Deucher

drm/amd/pm/smu7: fix a memleak in smu7_hwmgr_backend_init

The hwmgr->backend, (i.e. data) allocated by kzalloc is not freed in
the error-handling paths of smu7_get_evv_voltages and
smu7_update_edc_leakage_table. However, it did be freed in the
error-handling of phm_initializa_dynamic_state_adjustment_rule_settings,
by smu7_hwmgr_backend_fini. So the lack of free in smu7_get_evv_voltages
and smu7_update_edc_leakage_table is considered a memleak in this patch.

Fixes: 599a7e9f ("drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7.")
Fixes: 8f0804c6 ("drm/amd/pm: add edc leakage controller setting")
Signed-off-by: default avatarZhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b1a428b4
...@@ -2974,6 +2974,8 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr) ...@@ -2974,6 +2974,8 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
result = smu7_get_evv_voltages(hwmgr); result = smu7_get_evv_voltages(hwmgr);
if (result) { if (result) {
pr_info("Get EVV Voltage Failed. Abort Driver loading!\n"); pr_info("Get EVV Voltage Failed. Abort Driver loading!\n");
kfree(hwmgr->backend);
hwmgr->backend = NULL;
return -EINVAL; return -EINVAL;
} }
} else { } else {
...@@ -3019,8 +3021,10 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr) ...@@ -3019,8 +3021,10 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
} }
result = smu7_update_edc_leakage_table(hwmgr); result = smu7_update_edc_leakage_table(hwmgr);
if (result) if (result) {
smu7_hwmgr_backend_fini(hwmgr);
return result; return result;
}
return 0; return 0;
} }
......
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