From 818d53e12c758f08084d3bfa8e98aa73289a1287 Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Fri, 21 Apr 2017 22:40:55 +1000 Subject: [PATCH] drm/amdgpu: Fix null ptr dereference in SI dpm support Signed-off-by: Edward O'Callaghan Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100058 --- drivers/gpu/drm/amd/amdgpu/si_dpm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c index c5dec21..16a1d48 100644 --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c @@ -1961,9 +1961,9 @@ static struct rv7xx_power_info *rv770_get_pi(struct amdgpu_device *adev) static struct ni_power_info *ni_get_pi(struct amdgpu_device *adev) { - struct ni_power_info *pi = adev->pm.dpm.priv; + struct si_power_info *si_pi = adev->pm.dpm.priv; - return pi; + return si_pi->ni; } static struct si_ps *si_get_ps(struct amdgpu_ps *aps) @@ -2372,9 +2372,10 @@ static bool si_should_disable_uvd_powertune(struct amdgpu_device *adev, struct evergreen_power_info *evergreen_get_pi(struct amdgpu_device *adev) { - struct evergreen_power_info *pi = adev->pm.dpm.priv; + struct si_power_info *si_pi = adev->pm.dpm.priv; + struct ni_info *ni_pi = si_pi->ni; - return pi; + return ni_pi->eg; } static int si_populate_power_containment_values(struct amdgpu_device *adev, -- 2.9.3