提交 a423f79a 编写于 作者: A Alex Deucher

drm/amdgpu/powerplay/vega10: fix memory leak in error path

Free the backend structure if we fail to allocate device
memory.
Reviewed-by: NEvan Quan <evan.quan@amd.com>
Reviewed-by: NRex Zhu <Rex.Zhu@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 daf88096
...@@ -406,9 +406,8 @@ static int vega10_smu_init(struct pp_hwmgr *hwmgr) ...@@ -406,9 +406,8 @@ static int vega10_smu_init(struct pp_hwmgr *hwmgr)
&handle, &handle,
&mc_addr, &mc_addr,
&kaddr); &kaddr);
if (ret) if (ret)
return -EINVAL; goto free_backend;
priv->smu_tables.entry[PPTABLE].version = 0x01; priv->smu_tables.entry[PPTABLE].version = 0x01;
priv->smu_tables.entry[PPTABLE].size = sizeof(PPTable_t); priv->smu_tables.entry[PPTABLE].size = sizeof(PPTable_t);
...@@ -511,6 +510,9 @@ static int vega10_smu_init(struct pp_hwmgr *hwmgr) ...@@ -511,6 +510,9 @@ static int vega10_smu_init(struct pp_hwmgr *hwmgr)
amdgpu_bo_free_kernel(&priv->smu_tables.entry[PPTABLE].handle, amdgpu_bo_free_kernel(&priv->smu_tables.entry[PPTABLE].handle,
&priv->smu_tables.entry[PPTABLE].mc_addr, &priv->smu_tables.entry[PPTABLE].mc_addr,
&priv->smu_tables.entry[PPTABLE].table); &priv->smu_tables.entry[PPTABLE].table);
free_backend:
kfree(hwmgr->smu_backend);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册