summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2020-06-22 09:54:03 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2020-06-22 09:54:03 +0000
commit138d5e43e58ebc13e87c7831e2aa377fccfc3f51 (patch)
tree8f849f6273d79d9043b311eb527d11d08ac14bc0
parentca27008155303bc25474077107acc96137490480 (diff)
drm/amdgpu: Init data to avoid oops while reading pp_num_states.
From limingyu 4ceae1cf8ca686b64a68822677ef0fb69a917c4e in linux 5.7.y/5.7.5 6f81b2d047c59eb77cd04795a44245d6a52cdaec in mainline linux
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c
index 08022c0e35b..7201e6dfae7 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c
@@ -446,8 +446,11 @@ static ssize_t amdgpu_get_pp_num_states(struct device *dev,
ret = smu_get_power_num_states(&adev->smu, &data);
if (ret)
return ret;
- } else if (adev->powerplay.pp_funcs->get_pp_num_states)
+ } else if (adev->powerplay.pp_funcs->get_pp_num_states) {
amdgpu_dpm_get_pp_num_states(adev, &data);
+ } else {
+ memset(&data, 0, sizeof(data));
+ }
pm_runtime_mark_last_busy(ddev->dev);
pm_runtime_put_autosuspend(ddev->dev);