]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: Fix oops when pp_funcs is unset in ACPI event
authorAaron Ma <aaron.ma@canonical.com>
Fri, 3 Apr 2020 14:34:19 +0000 (22:34 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 3 Apr 2020 21:24:10 +0000 (17:24 -0400)
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
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

index f197f1be0969045743a2198d7fb79d70a7d437bc..abe94a55ecad4bf5fb489669a1fe7d5d2fccfc8c 100644 (file)
@@ -89,7 +89,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);