summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/amd
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2020-08-22 04:51:39 +0000
committerjsg <jsg@openbsd.org>2020-08-22 04:51:39 +0000
commitcc47ace77fd3842a1807f35733e1f70e6a5f4c12 (patch)
tree9687f0a4a48dad9fa9483dd32087971b87734289 /sys/dev/pci/drm/amd
parentdrm/amd/powerplay: fix compile error with ARCH=arc (diff)
downloadwireguard-openbsd-cc47ace77fd3842a1807f35733e1f70e6a5f4c12.tar.xz
wireguard-openbsd-cc47ace77fd3842a1807f35733e1f70e6a5f4c12.zip
drm/amd/powerplay: suppress compile error around BUG_ON
From Evan Quan ce8444749a649742fd88e5b9d05f352a478980ec in linux 5.7.y/5.7.16 75bc07e2403caea9ecac69f766dfb7dc33547594 in mainline linux
Diffstat (limited to 'sys/dev/pci/drm/amd')
-rw-r--r--sys/dev/pci/drm/amd/powerplay/arcturus_ppt.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/amd/powerplay/arcturus_ppt.c b/sys/dev/pci/drm/amd/powerplay/arcturus_ppt.c
index 5edf3eee925..bd3364b59ae 100644
--- a/sys/dev/pci/drm/amd/powerplay/arcturus_ppt.c
+++ b/sys/dev/pci/drm/amd/powerplay/arcturus_ppt.c
@@ -2035,8 +2035,6 @@ static void arcturus_fill_eeprom_i2c_req(SwI2cRequest_t *req, bool write,
{
int i;
- BUG_ON(numbytes > MAX_SW_I2C_COMMANDS);
-
req->I2CcontrollerPort = 0;
req->I2CSpeed = 2;
req->SlaveAddress = address;
@@ -2074,6 +2072,12 @@ static int arcturus_i2c_eeprom_read_data(struct i2c_adapter *control,
struct smu_table_context *smu_table = &adev->smu.smu_table;
struct smu_table *table = &smu_table->driver_table;
+ if (numbytes > MAX_SW_I2C_COMMANDS) {
+ dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n",
+ numbytes, MAX_SW_I2C_COMMANDS);
+ return -EINVAL;
+ }
+
memset(&req, 0, sizeof(req));
arcturus_fill_eeprom_i2c_req(&req, false, address, numbytes, data);
@@ -2110,6 +2114,12 @@ static int arcturus_i2c_eeprom_write_data(struct i2c_adapter *control,
SwI2cRequest_t req;
struct amdgpu_device *adev = to_amdgpu_device(control);
+ if (numbytes > MAX_SW_I2C_COMMANDS) {
+ dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n",
+ numbytes, MAX_SW_I2C_COMMANDS);
+ return -EINVAL;
+ }
+
memset(&req, 0, sizeof(req));
arcturus_fill_eeprom_i2c_req(&req, true, address, numbytes, data);