drm/radeon/dpm/atom: fix broken gcc harder
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Jul 2013 20:34:12 +0000 (16:34 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Jul 2013 20:35:06 +0000 (16:35 -0400)
See bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=66932
https://bugs.freedesktop.org/show_bug.cgi?id=66972
https://bugs.freedesktop.org/show_bug.cgi?id=66945

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/radeon_atombios.c

index 2606ec680ae356da79590d57be24ebab3feca5cf..e3f3e8841789a5c7a0234f73fb089dc0cf204687 100644 (file)
@@ -3699,18 +3699,21 @@ int radeon_atom_init_mc_reg_table(struct radeon_device *rdev,
                                                (ATOM_MEMORY_SETTING_DATA_BLOCK *)
                                                ((u8 *)reg_block + (2 * sizeof(u16)) +
                                                 le16_to_cpu(reg_block->usRegIndexTblSize));
+                                       ATOM_INIT_REG_INDEX_FORMAT *format = &reg_block->asRegIndexBuf[0];
                                        num_entries = (u8)((le16_to_cpu(reg_block->usRegIndexTblSize)) /
                                                           sizeof(ATOM_INIT_REG_INDEX_FORMAT)) - 1;
                                        if (num_entries > VBIOS_MC_REGISTER_ARRAY_SIZE)
                                                return -EINVAL;
                                        while (i < num_entries) {
-                                               if (reg_block->asRegIndexBuf[i].ucPreRegDataLength & ACCESS_PLACEHOLDER)
+                                               if (format->ucPreRegDataLength & ACCESS_PLACEHOLDER)
                                                        break;
                                                reg_table->mc_reg_address[i].s1 =
-                                                       (u16)(le16_to_cpu(reg_block->asRegIndexBuf[i].usRegIndex));
+                                                       (u16)(le16_to_cpu(format->usRegIndex));
                                                reg_table->mc_reg_address[i].pre_reg_data =
-                                                       (u8)(reg_block->asRegIndexBuf[i].ucPreRegDataLength);
+                                                       (u8)(format->ucPreRegDataLength);
                                                i++;
+                                               format = (ATOM_INIT_REG_INDEX_FORMAT *)
+                                                       ((u8 *)format + sizeof(ATOM_INIT_REG_INDEX_FORMAT));
                                        }
                                        reg_table->last = i;
                                        while ((*(u32 *)reg_data != END_OF_REG_DATA_BLOCK) &&