]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/radeonn: gcc fixes for rv7xx/eg/btc dpm
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 20 Aug 2013 22:51:08 +0000 (18:51 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Aug 2013 20:31:18 +0000 (16:31 -0400)
Newer versions of gcc seem to wander off into the
weeds when dealing with variable sizes arrays in
structs.  Rather than indexing the arrays, use
pointer arithmetic.

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/rv770_dpm.c

index 44c1e782a696fbe1e57e9f5bd57392781f554e0f..8cbb85dae5aa38500ac5803754ffcf94af613593 100644 (file)
@@ -2294,6 +2294,7 @@ int rv7xx_parse_power_table(struct radeon_device *rdev)
                         (power_state->v1.ucNonClockStateIndex *
                          power_info->pplib.ucNonClockSize));
                if (power_info->pplib.ucStateEntrySize - 1) {
+                       u8 *idx;
                        ps = kzalloc(sizeof(struct rv7xx_ps), GFP_KERNEL);
                        if (ps == NULL) {
                                kfree(rdev->pm.dpm.ps);
@@ -2303,12 +2304,12 @@ int rv7xx_parse_power_table(struct radeon_device *rdev)
                        rv7xx_parse_pplib_non_clock_info(rdev, &rdev->pm.dpm.ps[i],
                                                         non_clock_info,
                                                         power_info->pplib.ucNonClockSize);
+                       idx = (u8 *)&power_state->v1.ucClockStateIndices[0];
                        for (j = 0; j < (power_info->pplib.ucStateEntrySize - 1); j++) {
                                clock_info = (union pplib_clock_info *)
                                        (mode_info->atom_context->bios + data_offset +
                                         le16_to_cpu(power_info->pplib.usClockInfoArrayOffset) +
-                                        (power_state->v1.ucClockStateIndices[j] *
-                                         power_info->pplib.ucClockInfoSize));
+                                        (idx[j] * power_info->pplib.ucClockInfoSize));
                                rv7xx_parse_pplib_clock_info(rdev,
                                                             &rdev->pm.dpm.ps[i], j,
                                                             clock_info);