]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/amd/powerplay: Fix potential NULL pointer issue
authorXiangliang Yu <Xiangliang.Yu@amd.com>
Wed, 30 Nov 2016 06:07:16 +0000 (14:07 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 6 Dec 2016 23:08:38 +0000 (18:08 -0500)
If doesn't enable dpm, the powerplay will not allocate memory for
hw management. So, hw_init_power_state_table function will reference
NULL pointer when resetting.

Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/powerplay/amd_powerplay.c

index 51a36077b9939bc52f2c2c9ea0700b9c2bcaa744..c81cf14127289b7746e987f580cb132188d86e4e 100644 (file)
@@ -1004,12 +1004,12 @@ int amd_powerplay_reset(void *handle)
        if (ret)
                return ret;
 
-       hw_init_power_state_table(instance->hwmgr);
-
        if ((amdgpu_dpm == 0)
                || cgs_is_virtualization_enabled(instance->smu_mgr->device))
                return 0;
 
+       hw_init_power_state_table(instance->hwmgr);
+
        if (eventmgr == NULL || eventmgr->pp_eventmgr_init == NULL)
                return -EINVAL;