drm/amdgpu: remove redundant variable definition
authorGuchun Chen <guchun.chen@amd.com>
Wed, 18 Sep 2019 03:33:19 +0000 (11:33 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 3 Oct 2019 14:10:59 +0000 (09:10 -0500)
No need to define the same variables in each loop of the function.

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c

index d0e020ef73e34ff6c492aa8ca0ffdb24e53088aa..20af0a17d00b3075abd25d38045034c0cbc84ee8 100644 (file)
@@ -359,8 +359,9 @@ int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control,
                                            int num)
 {
        int i, ret = 0;
-       struct i2c_msg *msgs;
-       unsigned char *buffs;
+       struct i2c_msg *msgs, *msg;
+       unsigned char *buffs, *buff;
+       struct eeprom_table_record *record;
        struct amdgpu_device *adev = to_amdgpu_device(control);
 
        if (adev->asic_type != CHIP_VEGA20)
@@ -390,9 +391,9 @@ int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control,
         * 256b
         */
        for (i = 0; i < num; i++) {
-               unsigned char *buff = &buffs[i * (EEPROM_ADDRESS_SIZE + EEPROM_TABLE_RECORD_SIZE)];
-               struct eeprom_table_record *record = &records[i];
-               struct i2c_msg *msg = &msgs[i];
+               buff = &buffs[i * (EEPROM_ADDRESS_SIZE + EEPROM_TABLE_RECORD_SIZE)];
+               record = &records[i];
+               msg = &msgs[i];
 
                control->next_addr = __correct_eeprom_dest_address(control->next_addr);
 
@@ -432,8 +433,8 @@ int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control,
 
        if (!write) {
                for (i = 0; i < num; i++) {
-                       unsigned char *buff = &buffs[i*(EEPROM_ADDRESS_SIZE + EEPROM_TABLE_RECORD_SIZE)];
-                       struct eeprom_table_record *record = &records[i];
+                       buff = &buffs[i*(EEPROM_ADDRESS_SIZE + EEPROM_TABLE_RECORD_SIZE)];
+                       record = &records[i];
 
                        __decode_table_record_from_buff(control, record, buff + EEPROM_ADDRESS_SIZE);
                }