[PATCH] drm/amd/powerplay: avoid null pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <yttao@xxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux