drm/amd/powerplay: fix memory leak in cz_hwmgr backend
authorHawking Zhang <Hawking.Zhang@amd.com>
Tue, 6 Jun 2017 08:25:44 +0000 (16:25 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 6 Jun 2017 21:01:13 +0000 (17:01 -0400)
vddc_dep_on_dal_pwrl is allocated and initialized in cz_hwmgr_backend_init
Thus free the memory in cz_hwmgr_backend_fini

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

index 7aa5ca815a3aadfe95d3b1bff0b625761ee995aa..0b74da3dca8b5d83e2af51347a4afb5b77e43a40 100644 (file)
@@ -1224,6 +1224,12 @@ static int cz_hwmgr_backend_fini(struct pp_hwmgr *hwmgr)
                phm_destroy_table(hwmgr, &(hwmgr->disable_dynamic_state_management));
                phm_destroy_table(hwmgr, &(hwmgr->power_down_asic));
                phm_destroy_table(hwmgr, &(hwmgr->setup_asic));
+
+               if (NULL != hwmgr->dyn_state.vddc_dep_on_dal_pwrl) {
+                       kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl);
+                       hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL;
+               }
+
                kfree(hwmgr->backend);
                hwmgr->backend = NULL;
        }