diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index 15a1192c1ec5..8f98629fbe59 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | #include <linux/power_supply.h> | 31 | #include <linux/power_supply.h> |
| 32 | #include <linux/hwmon.h> | 32 | #include <linux/hwmon.h> |
| 33 | #include <linux/hwmon-sysfs.h> | 33 | #include <linux/hwmon-sysfs.h> |
| 34 | 34 | #include <linux/nospec.h> | |
| 35 | 35 | ||
| 36 | static int amdgpu_debugfs_pm_init(struct amdgpu_device *adev); | 36 | static int amdgpu_debugfs_pm_init(struct amdgpu_device *adev); |
| 37 | 37 | ||
| @@ -403,6 +403,7 @@ static ssize_t amdgpu_set_pp_force_state(struct device *dev, | |||
| 403 | count = -EINVAL; | 403 | count = -EINVAL; |
| 404 | goto fail; | 404 | goto fail; |
| 405 | } | 405 | } |
| 406 | idx = array_index_nospec(idx, ARRAY_SIZE(data.states)); | ||
| 406 | 407 | ||
| 407 | amdgpu_dpm_get_pp_num_states(adev, &data); | 408 | amdgpu_dpm_get_pp_num_states(adev, &data); |
| 408 | state = data.states[idx]; | 409 | state = data.states[idx]; |
| @@ -1185,7 +1186,7 @@ static ssize_t amdgpu_hwmon_show_vddnb(struct device *dev, | |||
| 1185 | int r, size = sizeof(vddnb); | 1186 | int r, size = sizeof(vddnb); |
| 1186 | 1187 | ||
| 1187 | /* only APUs have vddnb */ | 1188 | /* only APUs have vddnb */ |
| 1188 | if (adev->flags & AMD_IS_APU) | 1189 | if (!(adev->flags & AMD_IS_APU)) |
| 1189 | return -EINVAL; | 1190 | return -EINVAL; |
| 1190 | 1191 | ||
| 1191 | /* Can't get voltage when the card is off */ | 1192 | /* Can't get voltage when the card is off */ |
