because some asics have no smu.ppt_funcs
we need add one check for it otherwise
it will raise null pointer problem.

Signed-off-by: Yintian Tao <yt...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index a21ee035ca57..b8a42ebb2f5a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -160,7 +160,8 @@ static ssize_t amdgpu_get_dpm_state(struct device *dev,
        enum amd_pm_state_type pm;
 
        if (is_support_sw_smu(adev)) {
-               if (adev->smu.ppt_funcs->get_current_power_state)
+               if (adev->smu.ppt_funcs &&
+                   adev->smu.ppt_funcs->get_current_power_state)
                        pm = smu_get_current_power_state(&adev->smu);
                else
                        pm = adev->pm.dpm.user_state;
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to