drm/amd/powerplay: fix memory leak in cz_hwmgr.c
authorRex Zhu <Rex.Zhu@amd.com>
Wed, 28 Dec 2016 12:14:44 +0000 (20:14 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 27 Jan 2017 16:13:00 +0000 (11:13 -0500)
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c

index 1470177..2f0638c 100644 (file)
@@ -1217,9 +1217,16 @@ static int cz_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 
 static int cz_hwmgr_backend_fini(struct pp_hwmgr *hwmgr)
 {
-       if (hwmgr != NULL && hwmgr->backend != NULL)
+       if (hwmgr != NULL) {
+               phm_destroy_table(hwmgr, &(hwmgr->enable_clock_power_gatings));
+               phm_destroy_table(hwmgr, &(hwmgr->set_power_state));
+               phm_destroy_table(hwmgr, &(hwmgr->enable_dynamic_state_management));
+               phm_destroy_table(hwmgr, &(hwmgr->disable_dynamic_state_management));
+               phm_destroy_table(hwmgr, &(hwmgr->power_down_asic));
+               phm_destroy_table(hwmgr, &(hwmgr->setup_asic));
                kfree(hwmgr->backend);
-
+               hwmgr->backend = NULL;
+       }
        return 0;
 }