Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a423f79a authored by Alex Deucher's avatar Alex Deucher
Browse files

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



Free the backend structure if we fail to allocate device
memory.

Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarRex Zhu <Rex.Zhu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent daf88096
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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 @@ static int vega10_smu_init(struct pp_hwmgr *hwmgr)
	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;
}