| From 8a5bfc683c17abf3407e30e14150201a04a9259d Mon Sep 17 00:00:00 2001 |
| From: Aaron Ma <aaron.ma@canonical.com> |
| Date: Fri, 3 Apr 2020 22:34:19 +0800 |
| Subject: [PATCH] drm/amdgpu: Fix oops when pp_funcs is unset in ACPI event |
| |
| commit 5932d260a8d85a103bd6c504fbb85ff58b156bf9 upstream. |
| |
| 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@canonical.com> |
| Signed-off-by: Alex Deucher <alexander.deucher@amd.com> |
| Cc: stable@vger.kernel.org |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c |
| index d55519bc34e5..7d3080fc239c 100644 |
| --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c |
| +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c |
| @@ -75,7 +75,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.7.4 |
| |