Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/powerplay: Fix potential NULL pointer issue

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

authored by

Xiangliang Yu and committed by
Alex Deucher
e9efaaa0 84f3f05b

+2 -2
+2 -2
drivers/gpu/drm/amd/powerplay/amd_powerplay.c
··· 1004 1004 if (ret) 1005 1005 return ret; 1006 1006 1007 - hw_init_power_state_table(instance->hwmgr); 1008 - 1009 1007 if ((amdgpu_dpm == 0) 1010 1008 || cgs_is_virtualization_enabled(instance->smu_mgr->device)) 1011 1009 return 0; 1010 + 1011 + hw_init_power_state_table(instance->hwmgr); 1012 1012 1013 1013 if (eventmgr == NULL || eventmgr->pp_eventmgr_init == NULL) 1014 1014 return -EINVAL;