diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2018-03-13 20:43:00 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-03-14 16:01:18 -0500 |
commit | a423f79ad74710bf4d0c16bf0435ad84830dd35c (patch) | |
tree | 4f3fc0c5e95bbf0f6809cf165beefd6f837de7e7 | |
parent | daf8809626c0ee7a152f9c34058fc3b43385dd51 (diff) |
drm/amdgpu/powerplay/vega10: fix memory leak in error path
Free the backend structure if we fail to allocate device
memory.
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c index 15e1afa28018..219950882be9 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c @@ -406,9 +406,8 @@ static int vega10_smu_init(struct pp_hwmgr *hwmgr) &handle, &mc_addr, &kaddr); - if (ret) - return -EINVAL; + goto free_backend; priv->smu_tables.entry[PPTABLE].version = 0x01; priv->smu_tables.entry[PPTABLE].size = sizeof(PPTable_t); @@ -511,6 +510,9 @@ err0: amdgpu_bo_free_kernel(&priv->smu_tables.entry[PPTABLE].handle, &priv->smu_tables.entry[PPTABLE].mc_addr, &priv->smu_tables.entry[PPTABLE].table); +free_backend: + kfree(hwmgr->smu_backend); + return -EINVAL; } |