Merge tag 'drm-next-2021-08-31-1' of git://anongit.freedesktop.org/drm/drm
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_ras_eeprom.c
index 1945902..9dc3b2d 100644 (file)
@@ -114,23 +114,27 @@ static bool __get_eeprom_i2c_addr_arct(struct amdgpu_device *adev,
 static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
                                  struct amdgpu_ras_eeprom_control *control)
 {
+       uint8_t ras_rom_i2c_slave_addr;
+
        if (!control)
                return false;
 
        control->i2c_address = 0;
 
-       if (amdgpu_atomfirmware_ras_rom_addr(adev, (uint8_t*)&control->i2c_address))
+       if (amdgpu_atomfirmware_ras_rom_addr(adev, &ras_rom_i2c_slave_addr))
        {
-               if (control->i2c_address == 0xA0)
+               switch (ras_rom_i2c_slave_addr) {
+               case 0xA0:
                        control->i2c_address = 0;
-               else if (control->i2c_address == 0xA8)
+                       return true;
+               case 0xA8:
                        control->i2c_address = 0x40000;
-               else {
-                       dev_warn(adev->dev, "RAS EEPROM I2C address not supported");
+                       return true;
+               default:
+                       dev_warn(adev->dev, "RAS EEPROM I2C slave address %02x not supported",
+                                ras_rom_i2c_slave_addr);
                        return false;
                }
-
-               return true;
        }
 
        switch (adev->asic_type) {