[PATCH 1/1] UBUNTU: SAUCE: drm/amdgpu: Fix oops when pp_funcs is unset in ACPI event

Aaron Ma aaron.ma at canonical.com
Tue Apr 7 08:23:31 UTC 2020


BugLink: https://bugs.launchpad.net/bugs/1871316

On ARCTURUS and RENOIR, powerplay is not supported yet.
When plug in or unplug power jack, ACPI event will issue.
Then kernel NULL pointer BUG will be triggered.
Check for NULL pointers before calling.

Signed-off-by: Aaron Ma <aaron.ma at canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
(cherry picked from commit 170dbbf5ee571dbe11f847c27a15c6e28fdacfab
git://people.freedesktop.org/~agd5f/linux drm-next)
Signed-off-by: Aaron Ma <aaron.ma at canonical.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 03930313c263..51263b8d94b1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -90,7 +90,8 @@ void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev)
 			adev->pm.ac_power = true;
 		else
 			adev->pm.ac_power = false;
-		if (adev->powerplay.pp_funcs->enable_bapm)
+		if (adev->powerplay.pp_funcs &&
+		    adev->powerplay.pp_funcs->enable_bapm)
 			amdgpu_dpm_enable_bapm(adev, adev->pm.ac_power);
 		mutex_unlock(&adev->pm.mutex);
 	}
-- 
2.17.1




More information about the kernel-team mailing list