summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-03-18 17:47:29 +0100
committerAlex Deucher <alexander.deucher@amd.com>2016-03-21 16:52:13 +0100
commita82d397bffc2ff3a72e9b8ca3850771ff5cf451f (patch)
treecc8fcb1a62f77a65c6482b5a042ee4678c93c16e
parentdrm/amdgpu: release_pages requires linux/pagemap.h (diff)
downloadlinux-a82d397bffc2ff3a72e9b8ca3850771ff5cf451f.tar.xz
linux-a82d397bffc2ff3a72e9b8ca3850771ff5cf451f.zip
drm/amd/powerplay: fix memory leak of tdp_table
tdp_table is being leaked on failed allocations of hwmgr->dyn_state.cac_dtp_table. kfree tdp_table on the error return path to fix the leak. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
index 34f4bef3691f..b156481b50e8 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c
@@ -512,8 +512,10 @@ static int get_cac_tdp_table(
hwmgr->dyn_state.cac_dtp_table = kzalloc(table_size, GFP_KERNEL);
- if (NULL == hwmgr->dyn_state.cac_dtp_table)
+ if (NULL == hwmgr->dyn_state.cac_dtp_table) {
+ kfree(tdp_table);
return -ENOMEM;
+ }
memset(hwmgr->dyn_state.cac_dtp_table, 0x00, table_size);